Index: typo3/sysext/install/mod/class.tx_install.php =================================================================== --- typo3/sysext/install/mod/class.tx_install.php (revision 7289) +++ typo3/sysext/install/mod/class.tx_install.php (working copy) @@ -128,7 +128,6 @@ * 4823: function stepHeader() * 4865: function note123() * 4879: function endNotes() - * 4898: function convertByteSize($bytes) * 4912: function securityRisk() * 4930: function alterPasswordForm() * 4946: function messageBasicFinished() @@ -156,6 +155,7 @@ require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_installnewsysexts.php'); require_once(t3lib_extMgm::extPath('install') . 'mod/class.tx_install_session.php'); require_once(t3lib_extMgm::extPath('install') . 'updates/class.tx_coreupdates_statictemplates.php'); +require_once(PATH_tslib . 'class.tslib_content.php'); /** * Install Tool module @@ -166,14 +166,21 @@ * @subpackage tx_install */ class tx_install extends t3lib_install { + var $contentObject; + var $templateFilePath = 'typo3/sysext/install/Resources/Private/Templates/'; + var $template; + var $javascript; + var $stylesheets; + var $markers = array(); + var $messages = array(); + var $errorMessages = array(); + var $mailMessage = ''; var $getGD_start_string='

gd

'; // Used to identify the GD section in the output from phpinfo() var $getGD_end_string = ''; // 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='
'; - var $fontTag1='
'; var $updateIdentity = 'TYPO3 Install Tool'; var $headerStyle =''; var $contentBeforeTable=''; @@ -187,11 +194,11 @@ 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. + var $totalSteps = 4; // Can be changed by hook to define the total steps in 123 mode // 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; @@ -240,14 +247,15 @@ /** * Constructor * - * @return [type] ... + * @return void */ - function tx_install() { + function tx_install() { parent::t3lib_install(); + $this->contentObject = t3lib_div::makeInstance('tslib_cObj'); if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword']) die("Install Tool deactivated.
You must enable it by setting a password in typo3conf/localconf.php. If you insert the line below, the password will be 'joh316':

\$TYPO3_CONF_VARS['BE']['installToolPassword'] = 'bacb98acf97e0b6112b1d1b650b84971';"); - if ($this->sendNoCacheHeaders) { + 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'); @@ -282,11 +290,19 @@ } } - if ($this->step == 3) { + if ($this->step == 4) { $this->INSTALL['type'] = 'database'; } - if ($this->mode=='123') { + // Hook to raise the counter for the total steps in the 1-2-3 installer + if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['additionalSteps'])) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['additionalSteps'] as $classData) { + $hookObject = t3lib_div::getUserObj($classData); + $this->totalSteps += (integer) $hookObject->execute(); + } + } + + if ($this->mode=='123') { $tempItems = $this->menuitems; $this->menuitems = array( 'config' => $tempItems['config'], @@ -331,7 +347,7 @@ '; } - if ($this->session->isAuthorized() || $this->checkPassword()) { + if ($this->session->isAuthorized() || $this->checkPassword()) { $this->passwordOK=1; $this->session->refreshSession(); @@ -341,7 +357,7 @@ @touch($enableInstallToolFile); } - if($this->redirect_url) { + if($this->redirect_url) { t3lib_utility_Http::redirect($this->redirect_url); } } else { @@ -360,12 +376,12 @@ function checkPassword() { $p = t3lib_div::_GP('password'); - if ($p && md5($p)==$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword']) { + if ($p && md5($p)==$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword']) { $this->session->setAuthorized(); // Sending warning email $wEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr']; - if ($wEmail) { + 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, @@ -377,9 +393,9 @@ return true; } else { // Bad password, send warning: - if ($p) { + if ($p) { $wEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr']; - if ($wEmail) { + if ($wEmail) { $subject="Install Tool Login ATTEMPT at '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."'"; $email_body="There has been an Install Tool login attempt at TYPO3 site '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."' (".t3lib_div::getIndpEnv('HTTP_HOST')."). The MD5 hash of the last 5 characters of the password tried was '".substr(md5($p), -5)."' @@ -396,62 +412,142 @@ } /** - * [Describe function...] + * Create the HTML for the login form * - * @return [type] ... + * Reads and fills the template. + * Substitutes subparts when wrong password has been given + * or the session has expired + * + * @return void */ - function loginForm() { - $p = t3lib_div::_GP('password'); + function loginForm() { + $password = t3lib_div::_GP('password'); $redirect_url = $this->redirect_url ? $this->redirect_url : $this->action; - - $this->messageFunc_nl2br=0; - $this->silent=0; - - $content = '
-
- -
-
- - '.$this->fw('The Install Tool Password is not the admin password of TYPO3.
- 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 ? '

The password you just tried has this md5-value:

'.md5($p) : '') - ).' -
- '; - + // Add prototype to javascript array for output + $this->javascript[] = ' + '; + // Get the template file + $templateFile = @file_get_contents( + PATH_site . $this->templateFilePath . 'LoginForm.html' + ); + // Get the template part from the file + $template = $this->contentObject->getSubpart( + $templateFile, '###TEMPLATE###' + ); + // Password has been given, but this form is rendered again. + // This means the given password was wrong + if (!empty($password)) { + // Get the subpart for the wrong password + $wrongPasswordSubPart = $this->contentObject->getSubpart( + $template, '###WRONGPASSWORD###' + ); + // Define the markers content + $wrongPasswordMarkers = array( + 'passwordMessage' => 'The password you just tried has this md5-value:', + 'password' => md5($password) + ); + // Fill the markers in the subpart + $wrongPasswordSubPart = $this->contentObject->substituteMarkerArray( + $wrongPasswordSubPart, + $wrongPasswordMarkers, + '###|###', + 1, + 1 + ); + } + // Session has expired if (!$this->session->isAuthorized() && $this->session->isExpired()) { - $this->message('Password', 'Your install tool session has expired', '', 3); + // Get the subpart for the expired session message + $sessionExpiredSubPart = $this->contentObject->getSubpart( + $template, '###SESSIONEXPIRED###' + ); + // Define the markers content + $sessionExpiredMarkers = array( + 'message' => 'Your install tool session has expired' + ); + // Fill the markers in the subpart + $sessionExpiredSubPart = $this->contentObject->substituteMarkerArray( + $sessionExpiredSubPart, + $sessionExpiredMarkers, + '###|###', + 1, + 1 + ); } - $this->message('Password', 'Enter the Install Tool Password', $content, 0); - $this->output($this->outputWrapper($this->printAll())); + // Substitute the subpart for the expired session in the template + $template = $this->contentObject->substituteSubpart( + $template, + '###SESSIONEXPIRED###', + $sessionExpiredSubPart + ); + // Substitute the subpart for the wrong password in the template + $template = $this->contentObject->substituteSubpart( + $template, + '###WRONGPASSWORD###', + $wrongPasswordSubPart + ); + // Define the markers content + $markers = array( + 'siteName' => 'Site: ' . + $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], + 'headTitle' => 'Login to TYPO3 ' . TYPO3_version . ' Install tool', + 'redirectUrl' => htmlspecialchars($redirect_url), + 'enterPassword' => 'Password', + 'login' => 'Login', + 'message' => ' +

+ The Install Tool Password is not the admin password + of TYPO3. +
+ 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. +

+ ' + ); + // Fill the markers in the template + $content = $this->contentObject->substituteMarkerArray( + $template, + $markers, + '###|###', + 1, + 1 + ); + // Send content to the page wrapper function + $this->output($this->outputWrapper($content)); } /** - * Calling function that checks system, IM, GD, dirs, database and lets you alter localconf.php + * 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 void + * @return void */ - function init() { - if (!defined('PATH_typo3')) exit; // Must be called after inclusion of init.php (or from init.php) + function init() { + // Must be called after inclusion of init.php (or from init.php) + if (!defined('PATH_typo3')) exit; if (!$this->passwordOK) exit; // Setting stuff... $this->check_mail(); $this->setupGeneral(); $this->generateConfigForm(); - if (count($this->messages)) t3lib_div::debug($this->messages); + if (count($this->messages)) { + t3lib_div::debug($this->messages); + } - if ($this->step) { + if ($this->step) { $this->output($this->outputWrapper($this->stepOutput())); } else { // Menu... - switch($this->INSTALL['type']) { + switch($this->INSTALL['type']) { case 'images': $this->checkIM=1; $this->checkTheConfig(); @@ -471,58 +567,162 @@ case 'config': $this->silent=0; $this->checkIM=1; - $this->message('About configuration','How to configure TYPO3',$this->generallyAboutConfiguration()); + $this->message( + 'About configuration', + 'How to configure TYPO3', + $this->generallyAboutConfiguration() + ); + $this->message( + 'System Information', + 'Your system has the following configuration', + ' +
+
OS detected:
+
' . (TYPO3_OS == 'WIN' ? 'WIN' : 'UNIX') .'
+
UNIX/CGI detected:
+
' . (PHP_SAPI == 'cgi' ? 'YES' : 'NO') . '
+
PATH_thisScript:
+
' . PATH_thisScript . '
+
+ ' + ); $this->checkTheConfig(); $ext = 'Write config to localconf.php'; - if ($this->fatalError) { - if ($this->config_array['no_database'] || !$this->config_array['mysqlConnect']) { + 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); +

+ 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); +

+ 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) { + 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. - - Step 2: Click here to install the database. - ',-1,1); +

+ 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. +

+

+ + Step 2: + + Click here to install the database. +

+ ', -1, 1); } } - $this->message($ext, 'Very Important: Changing Image Processing settings', " - When you change the settings for Image Processing you must take into account that old images 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 setScriptName('typo3temp'))."\">clearing the typo3temp/ folder. 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 must take into account that a change to this value might invalidate temporary information, URLs etc. - The problem is solved by setScriptName('typo3temp'))."\">clearing the typo3temp/ folder. 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); + $this->message($ext, 'Very Important: Changing Image Processing settings', ' +

+ When you change the settings for Image Processing + you must take into account + that old images 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 clearing the typo3temp/ folder. + 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 must take into account that a change to + this value might invalidate temporary information, + URLs etc. +
+ The problem is solved by clearing the typo3temp/ folder. + 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); $this->output($this->outputWrapper($this->printAll())); break; case 'extConfig': $this->silent=0; - $this->generateConfigForm('get_form'); - - $content = $this->printAll(); - $content = '
'.$content.'

- '.$this->fw('NOTICE: By clicking this button, localconf.php is updated with new values for the parameters listed above!
').' -
'; + // Get the template file + $templateFile = @file_get_contents( + PATH_site . $this->templateFilePath . 'InitExtConfig.html' + ); + // Get the template part from the file + $template = $this->contentObject->getSubpart( + $templateFile, '###TEMPLATE###' + ); + // Define the markers content + $markers = array( + 'action' => $this->action, + 'content' => $this->printAll(), + 'write' => 'Write to localconf.php', + 'notice' => 'NOTICE:', + 'explanation' => ' + By clicking this button, localconf.php is updated + with new values for the parameters listed above! + ' + ); + // Fill the markers in the template + $content = $this->contentObject->substituteMarkerArray( + $template, + $markers, + '###|###', + 1, + 1 + ); + // Send content to the page wrapper function $this->output($this->outputWrapper($content)); break; case 'typo3temp': @@ -548,60 +748,152 @@ $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: + $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: +

+

+ 1: Basic Configuration +
+ 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. +

+

+ 2: Database Analyser +
+ 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 against your + \'tables.php\' configuration ($TCA) and you can + even see suggestions to entries in $TCA or new + fields in the database. +

+

+ 3: Update Wizard +
+ 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. +

+

+ 4: Image Processing +
+ 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. +

+

+ 5: All Configuration +
+ 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. +

+

+ 6: typo3temp/ +
+ 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. +

+ '); - 1: Basic Configuration - 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. + $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 only when calling the script + \'typo3/install/index.php\' - this script! +

+ '); - 2: Database Analyser - 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. - 3: Update Wizard - 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. - - 4: Image Processing - 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. - - 5: All Configuration - 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. - - 6: typo3temp/ - 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 only when calling the script 'typo3/install/index.php' - this script! - "); - - $headCode='Header legend'; $this->message($headCode, 'Notice!', ' - Indicates that something is important to be aware of. - This does not indicate an error. - ',1); +

+ Indicates that something is important to be aware + of. +
+ This does not indicate an error. +

+ ', 1); $this->message($headCode, 'Just information', ' - This is a simple message with some information about something. +

+ 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); +

+ Indicates that something was checked and returned an + expected result. +

+ ', -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 potential error. - ',2); +

+ Indicates that something may very well cause trouble + and you should definitely look into it before + proceeding. +
+ This indicates a potential 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); +

+ 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); $this->output($this->outputWrapper($this->printAll())); break; @@ -612,283 +904,383 @@ /** * Controls the step 1-2-3-go process * - * @return string the content to output to the screen + * @return string The content to output to the screen */ - function stepOutput() { + function stepOutput() { + // Get the template file + $templateFile = @file_get_contents( + PATH_site . $this->templateFilePath . 'StepOutput.html' + ); + // Get the template part from the file + $template = $this->contentObject->getSubpart( + $templateFile, '###TEMPLATE###' + ); + // Define the markers content + $markers = array( + 'stepHeader' => $this->stepHeader(), + 'notice' => 'Skip this wizard (for powerusers only)', + 'skip123' => $this->scriptSelf + ); + $this->checkTheConfig(); - $error_missingConnect='
- '.$this->fontTag2.' - There is no connection to the database!
- (Username: ' . TYPO3_db_username . ', Host: ' . TYPO3_db_host . ', Using Password: YES) .
-
- Go to Step 1 and enter a proper username/password! -
-
+ $error_missingConnect = ' +

+ + There is no connection to the database! + +
+ (Username: ' . TYPO3_db_username . ', + Host: ' . TYPO3_db_host . ', + Using Password: YES) +
+ Go to Step 1 and enter a proper username/password! +

'; - $error_missingDB='
- '.$this->fontTag2.' - There is no access to the database ('.TYPO3_db.')!
-
- Go to Step 2 and select an accessible database! -
-
+ $error_missingDB = ' +

+ + There is no access to the database (' . TYPO3_db . ')! + +
+ Go to Step 2 and select an accessible database! +

'; - // only get the number of tables if it is not the first step in the 123-installer + // only get the number of tables if it is not the first two steps in the 123-installer // (= no DB connection yet) - $whichTables = ($this->step != 1 ? $this->getListOfTables() : array()); - $dbInfo=' - - - - - - - - - - - - - - - - - - - - -
'.$this->fontTag2.'Database summary:
'.$this->fontTag1.'Username:'.$this->fontTag1.''.TYPO3_db_username.'
'.$this->fontTag1.'Host:'.$this->fontTag1.''.TYPO3_db_host.'
'.$this->fontTag1.'Database:'.$this->fontTag1.''.TYPO3_db.'
'.$this->fontTag1.'# of tables:'.$this->fontTag1.''.(count($whichTables)?''.count($whichTables).'':count($whichTables)).'
+ $whichTables = ($this->step != 1 && $this->step != 2 ? $this->getListOfTables() : array()); + + $error_emptyDB = ' +

+ + The database is still empty. There are no tables! + +
+ Go to Step 3 and import a database! +

'; - $error_emptyDB='
- '.$this->fontTag2.' - The database is still empty. There are no tables!
-
- Go to Step 3 and import a database! -
-
- '; - switch(strtolower($this->step)) { - case 1: - $msg=' -
-
- - - - - - - - - - - - - - - - - - - - - - - -
- '.$this->fontTag2.'Username: -   - - '.$this->fontTag2.' -
-
- '.$this->fontTag2.'Password: -   - - '.$this->fontTag2.' -
-
- '.$this->fontTag2.'Host: -   - - '.$this->fontTag2.' -
-
- '.$this->fontTag1.' -   - - '.$this->fontTag1.'
- - - -

NOTICE: By clicking this button, typo3conf/localconf.php is updated with new values for the parameters listed above!
-
-
-
'; - break; - case 2: - if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { - $dbArr = $this->getDatabaseList(); - $options = ''; - $dbIncluded = 0; - foreach ($dbArr as $dbname) { - $options.=''; - if ($dbname==TYPO3_db) $dbIncluded=1; - } - if (!$dbIncluded && TYPO3_db) { - $options.=''; - } - $select=''; - $msg=' -
-
- - - - - - - - - - - - - - - - - - -
- '.$this->fontTag2.' - You have two options:
-

+ // Hook to override and add steps to the 1-2-3 installer + if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['stepOutput'])) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['stepOutput'] as $classData) { + $hookObject = t3lib_div::getUserObj($classData); + $hookObject->execute($markers, $this->step, $this); + } + } + // Use the default steps when there is no override + if (!$markers['header'] && !$markers['step']) { + switch(strtolower($this->step)) { + case 1: + // Get the subpart for the first step + $step1SubPart = $this->contentObject->getSubpart( + $templateFile, '###STEP1###' + ); + // Add header marker for main template + $markers['header'] = 'Welcome to the TYPO3 installation process'; + // Define the markers content for the subpart + $step1SubPartMarkers = array( + 'llIntroduction' => ' +

+ TYPO3 is an enterprise content management system + that is very powerfull and yet easy to install. +

+

+ Choose your database, import some data and + you\'re done! +

+ ', + 'step' => $this->step + 1, + 'action' => htmlspecialchars($this->action), + 'continue' => 'Continue' + ); + // Add step marker for main template + $markers['step'] = $this->contentObject->substituteMarkerArray( + $step1SubPart, + $step1SubPartMarkers, + '###|###', + 1, + 1 + ); + break; + case 2: + // Get the subpart for the second step + $step2SubPart = $this->contentObject->getSubpart( + $templateFile, '###STEP2###' + ); + // Add header marker for main template + $markers['header'] = 'Connect to your database host'; + // Define the markers content for the subpart + $step2SubPartMarkers = array( + 'step' => $this->step + 1, + 'action' => htmlspecialchars($this->action), + 'encryptionKey' => $this->createEncryptionKey(), + 'branch' => TYPO3_branch, + 'labelUsername' => 'Username', + 'username' => TYPO3_db_username, + 'labelPassword' => 'Password', + 'password' => TYPO3_db_password, + 'labelHost' => 'Host', + 'host' => TYPO3_db_host ? TYPO3_db_host : 'localhost', + 'continue' => 'Continue' + ); + // Add step marker for main template + $markers['step'] = $this->contentObject->substituteMarkerArray( + $step2SubPart, + $step2SubPartMarkers, + '###|###', + 1, + 1 + ); + break; + case 3: + // Add header marker for main template + $markers['header'] = 'Select database'; + // There should be a database host connection at this point + if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect( + TYPO3_db_host, TYPO3_db_username, TYPO3_db_password + )) { + // Get the subpart for the third step + $step3SubPart = $this->contentObject->getSubpart( + $templateFile, '###STEP3###' + ); + // Get the subpart for the database options + $step3DatabaseOptionsSubPart = $this->contentObject->getSubpart( + $step3SubPart, '###DATABASEOPTIONS###' + ); - 1: Select an existing EMPTY database:
-
- '.$this->fontTag1.'Any existing tables which are used by TYPO3 will be overwritten in Step 3. So make sure this database is empty:
'.$select.'
-

-
- - '.$this->fontTag2.'2: Create new database (recommended): -
- '.$this->fontTag1.'Enter the desired name of the database here:

-

- - '.$this->fontTag1.'
- -

NOTICE: By clicking this button, typo3conf/localconf.php is updated with new values for the parameters listed above!
-
-
-
- '; - } else { - $msg=$error_missingConnect; - } - break; - case 3: - if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { - if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) { - $sFiles = t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1); - - // Check if default database scheme "database.sql" already exists, otherwise create it - if (!strstr(implode(',',$sFiles).',', '/database.sql,')) { - array_unshift($sFiles,'Create default database tables'); + $dbArr = $this->getDatabaseList(); + $dbIncluded = 0; + foreach ($dbArr as $dbname) { + // Define the markers content for database options + $step3DatabaseOptionMarkers = array( + 'databaseValue' => htmlspecialchars($dbname), + 'databaseSelected' => $dbname == TYPO3_db ? 'selected="selected"' : '', + 'databaseName' => htmlspecialchars($dbname) + ); + // Add the option HTML to an array + $step3DatabaseOptions[] = $this->contentObject->substituteMarkerArray( + $step3DatabaseOptionsSubPart, + $step3DatabaseOptionMarkers, + '###|###', + 1, + 1 + ); + if ($dbname==TYPO3_db) $dbIncluded=1; } - - $opt=''; - foreach ($sFiles as $f) { - if ($f=='Create default database tables') $key='CURRENT_TABLES+STATIC'; - else $key=htmlspecialchars($f); - - $opt.=''; + if (!$dbIncluded && TYPO3_db) { + // // Define the markers content when no access + $step3DatabaseOptionMarkers = array( + 'databaseValue' => htmlspecialchars(TYPO3_db), + 'databaseSelected' => 'selected="selected"', + 'databaseName' => htmlspecialchars(TYPO3_db) . ' (NO ACCESS!)' + ); + // Add the option HTML to an array + $step3DatabaseOptions[] = $this->contentObject->substituteMarkerArray( + $step3DatabaseOptionsSubPart, + $step3DatabaseOptionMarkers, + '###|###', + 1, + 1 + ); } + // Substitute the subpart for the database options + $content = $this->contentObject->substituteSubpart( + $step3SubPart, + '###DATABASEOPTIONS###', + implode(chr(10), $step3DatabaseOptions) + ); + // Define the markers content + $step3SubPartMarkers = array( + 'step' => $this->step + 1, + 'llOptions' => 'You have two options in this step.', + 'action' => htmlspecialchars($this->action), + 'llOption1' => '1: Create new database (recommended):', + 'llRemark1' => 'Enter your desired name for the database.', + 'llOption2' => '2: Select an EMPTY existing database:', + 'llRemark2' => 'All tables used by TYPO3 will be overwritten in step 3.', + 'continue' => 'Continue' + ); + // Add step marker for main template + $markers['step'] = $this->contentObject->substituteMarkerArray( + $content, + $step3SubPartMarkers, + '###|###', + 1, + 1 + ); + } else { + // Add step marker for main template when no connection + $markers['step'] = $error_missingConnect; + } + break; + case 4: + // Add header marker for main template + $markers['header'] = 'Import the database sql-file'; + // There should be a database host connection at this point + if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect( + TYPO3_db_host, TYPO3_db_username, TYPO3_db_password + )) { + // The selected database should be accessible + if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) { + // Get the subpart for the fourth step + $step4SubPart = $this->contentObject->getSubpart( + $templateFile, '###STEP4###' + ); + // Get the subpart for the database type options + $step4DatabaseTypeOptionsSubPart = $this->contentObject->getSubpart( + $step4SubPart, '###DATABASETYPEOPTIONS###' + ); + $sFiles = t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1); - $content=' - '.$this->fontTag2.'Please select a database dump:
- - - -
'; + // Check if default database scheme "database.sql" already exists, otherwise create it + if (!strstr(implode(',',$sFiles).',', '/database.sql,')) { + array_unshift($sFiles,'Create default database tables'); + } - $content = $this->getUpdateDbFormWrap('import', $content, 'Import database'); - - $msg=' -
- '.$dbInfo.'
-
- '.$content.' - - '; - + $opt=''; + foreach ($sFiles as $f) { + if ($f=='Create default database tables') $key='CURRENT_TABLES+STATIC'; + else $key=htmlspecialchars($f); + // Define the markers content for database type subpart + $step4DatabaseTypeOptionMarkers = array( + 'databaseTypeValue' => 'import|' . $key, + 'databaseName' => htmlspecialchars(basename($f)) + ); + // Add the option HTML to an array + $step4DatabaseTypeOptions[] = $this->contentObject->substituteMarkerArray( + $step4DatabaseTypeOptionsSubPart, + $step4DatabaseTypeOptionMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for the database type options + $content = $this->contentObject->substituteSubpart( + $step4SubPart, + '###DATABASETYPEOPTIONS###', + implode(chr(10), $step4DatabaseTypeOptions) + ); + // Define the markers content + $step4SubPartMarkers = array( + 'llSummary' => 'Database summary:', + 'llUsername' => 'Username:', + 'username' => TYPO3_db_username, + 'llHost' => 'Host:', + 'host' => TYPO3_db_host, + 'llDatabase' => 'Database:', + 'database' => TYPO3_db, + 'llNumberTables' => 'Number of tables:', + 'numberTables' => count($whichTables), + 'action' => htmlspecialchars($this->action), + 'llDatabaseType' => 'Please select a database dump:', + 'label' => 'Import database' + ); + // Add step marker for main template + $markers['step'] = $this->contentObject->substituteMarkerArray( + $content, + $step4SubPartMarkers, + '###|###', + 1, + 1 + ); + } else { + // Add step marker for main template when no database + $markers['step'] = $error_missingDB; + } } else { - $msg=$error_missingDB; + // Add step marker for main template when no connection + $markers['step'] = $error_missingConnect; } - } else { - $msg=$error_missingConnect; - } - break; - case 'go': - if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { - if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) { - if (count($whichTables)) { - $msg=' -
- '.$this->fontTag2.' - '.nl2br($this->messageBasicFinished()).' -
-
-
IMPORTANT

- '.nl2br($this->securityRisk()).' -
- Enter "Normal" mode for the Install Tool to change this!
- -
-
- '; + break; + case 'go': + // Add header marker for main template + $markers['header'] = 'You\'re done!'; + // There should be a database host connection at this point + if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect( + TYPO3_db_host, TYPO3_db_username, TYPO3_db_password + )) { + // The selected database should be accessible + if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) { + // The database should contain tables + if (count($whichTables)) { + // Get the subpart for the go step + $stepGoSubPart = $this->contentObject->getSubpart( + $templateFile, '###STEPGO###' + ); + // Define the markers content + $stepGoSubPartMarkers = array( + 'messageBasicFinished' => $this->messageBasicFinished(), + 'llImportant' => 'Important', + 'securityRisk' => $this->securityRisk(), + 'llSwitchMode' => 'Enter + + "Normal" + + mode for the Install Tool to change this! + ' + ); + // Add step marker for main template + $markers['step'] = $this->contentObject->substituteMarkerArray( + $stepGoSubPart, + $stepGoSubPartMarkers, + '###|###', + 1, + 1 + ); + } else { + // Add step marker for main template when empty database + $markers['step'] = $error_emptyDB; + } } else { - $msg=$error_emptyDB; + // Add step marker for main template when no database + $markers['step'] = $error_missingDB; } } else { - $msg=$error_missingDB; + // Add step marker for main template when no connection + $markers['step'] = $error_missingConnect; } - } else { - $msg=$error_missingConnect; - } - break; + break; + } } - return $msg; + // Fill the markers in the template + $content = $this->contentObject->substituteMarkerArray( + $template, + $markers, + '###|###', + 1, + 1 + ); + + return $content; } /** * Calling the functions that checks the system * - * @return [type] ... + * @return void */ - function checkTheConfig() { + function checkTheConfig() { // Order important: $this->checkDirs(); $this->checkConfiguration(); $this->checkExtensions(); - if (TYPO3_OS=='WIN') { + if (TYPO3_OS=='WIN') { $paths=array($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'], $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'], 'c:\\php\\imagemagick\\', 'c:\\php\\GraphicsMagick\\', 'c:\\apache\\ImageMagick\\', 'c:\\apache\\GraphicsMagick\\'); } else { $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/'); } asort($paths); - if (ini_get('safe_mode')) { + if (ini_get('safe_mode')) { $paths=array(ini_get('safe_mode_exec_dir'),'/usr/local/php/bin/'); } - if ($this->INSTALL['checkIM']['lzw']) { + if ($this->INSTALL['checkIM']['lzw']) { $this->checkIMlzw=1; } - if ($this->INSTALL['checkIM']['path']) { + if ($this->INSTALL['checkIM']['path']) { $paths[]=trim($this->INSTALL['checkIM']['path']); } if ($this->checkIM) $this->checkImageMagick($paths); @@ -898,118 +1290,226 @@ /** * Editing files in typo3conf directory (or elsewhere if enabled) * - * @return [type] ... + * @return void */ - function typo3conf_edit() { - $EDIT_path = PATH_typo3conf; // default: - if ($this->allowFileEditOutsite_typo3conf_dir && $this->INSTALL['FILE']['EDIT_path']) { - if (t3lib_div::validPathStr($this->INSTALL['FILE']['EDIT_path']) && substr($this->INSTALL['FILE']['EDIT_path'],-1)=='/') { + function typo3conf_edit() { + // default: + $EDIT_path = PATH_typo3conf; + if ($this->allowFileEditOutsite_typo3conf_dir && $this->INSTALL['FILE']['EDIT_path']) { + if (t3lib_div::validPathStr($this->INSTALL['FILE']['EDIT_path']) && substr($this->INSTALL['FILE']['EDIT_path'],-1)=='/') { $tmp_path = PATH_site.$this->INSTALL['FILE']['EDIT_path']; - if (is_dir($tmp_path)) { + if (is_dir($tmp_path)) { $EDIT_path=$tmp_path; - } else {debug("'".$tmp_path."' was not dir");} + } else { + $this->errorMessages[] = ' + \'' . $tmp_path . '\' was not directory + '; + } } else { - debug('BAD DIR_NAME (must be like t3lib/ or media/script/)'); + $this->errorMessages[] = ' + Bad directory name (must be like t3lib/ or media/script/) + '; } } $headCode = 'Edit files in '.basename($EDIT_path).'/'; - $this->contentBeforeTable=''; + $messages = ''; - if ($this->INSTALL['SAVE_FILE']) { + if ($this->INSTALL['SAVE_FILE']) { $save_to_file = $this->INSTALL['FILE']['name']; - if (@is_file($save_to_file)) { + if (@is_file($save_to_file)) { $save_to_file_md5 = md5($save_to_file); - if (isset($this->INSTALL['FILE'][$save_to_file_md5]) && t3lib_div::isFirstPartOfStr($save_to_file,$EDIT_path.'') && substr($save_to_file,-1)!='~' && !strstr($save_to_file,'_bak')) { + if (isset($this->INSTALL['FILE'][$save_to_file_md5]) && t3lib_div::isFirstPartOfStr($save_to_file,$EDIT_path.'') && substr($save_to_file,-1)!='~' && !strstr($save_to_file,'_bak')) { $this->INSTALL['typo3conf_files'] = $save_to_file; $save_fileContent = $this->INSTALL['FILE'][$save_to_file_md5]; - if ($this->INSTALL['FILE']['win_to_unix_br']) { + if ($this->INSTALL['FILE']['win_to_unix_br']) { $save_fileContent = str_replace(chr(13).chr(10),chr(10),$save_fileContent); } $backupFile = $this->getBackupFilename($save_to_file); - if ($this->INSTALL['FILE']['backup']) { - if (@is_file($backupFile)) { unlink($backupFile); } + if ($this->INSTALL['FILE']['backup']) { + if (@is_file($backupFile)) { unlink($backupFile); } rename($save_to_file,$backupFile); - $this->contentBeforeTable.='Backup written to '.$backupFile.'
'; + $messages .= ' + Backup written to ' . $backupFile . ' +
+ '; } t3lib_div::writeFile($save_to_file,$save_fileContent); - $this->contentBeforeTable.=' - File saved: '.$save_to_file.'
- MD5-sum: '.$this->INSTALL['FILE']['prevMD5'].' (prev)
- MD5-sum: '.md5($save_fileContent).' (new)
+ $messages .= ' + File saved: ' . $save_to_file . ' +
+ MD5-sum: ' . $this->INSTALL['FILE']['prevMD5'] . ' (prev) +
+ MD5-sum: ' . md5($save_fileContent) . ' (new) +
'; } } } // Filelist: + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'Typo3ConfEdit.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Get the subpart for the files + $filesSubpart = $this->contentObject->getSubpart($template, '###FILES###'); + $files = array(); + $typo3conf_files = t3lib_div::getFilesInDir($EDIT_path,'',1,1); - reset($typo3conf_files); - $lines=array(); $fileFound = 0; - while(list($k,$file)=each($typo3conf_files)) { + + + foreach ($typo3conf_files as $k => $file) { // Delete temp_CACHED files if option is set - if ( $this->INSTALL['delTempCached'] && preg_match('|/temp_CACHED_[a-z0-9_]+\.php|', $file)) { + if ( $this->INSTALL['delTempCached'] && preg_match('|/temp_CACHED_[a-z0-9_]+\.php|', $file)) { unlink($file); continue; } - if ($this->INSTALL['typo3conf_files'] && !strcmp($this->INSTALL['typo3conf_files'],$file)) { - $wrap=array('',''); + if ($this->INSTALL['typo3conf_files'] && !strcmp($this->INSTALL['typo3conf_files'],$file)) { $fileFound = 1; - } else {$wrap=array();} - $lines[]=''.$this->fw($wrap[0].basename($file).$wrap[1].'   ').''.$this->fw(t3lib_div::formatSize(filesize($file))).''; + } + // Define the markers content for the files subpart + $filesMarkers = array( + 'editUrl' => $this->action . '&TYPO3_INSTALL[typo3conf_files]=' . rawurlencode($file) . ($this->allowFileEditOutsite_typo3conf_dir ? '&TYPO3_INSTALL[FILE][EDIT_path]=' . rawurlencode($this->INSTALL['FILE']['EDIT_path']) : '') . '#confEditFileList', + 'fileName' => basename($file), + 'fileSize' => t3lib_div::formatSize(filesize($file)), + 'class' => $this->INSTALL['typo3conf_files'] && !strcmp($this->INSTALL['typo3conf_files'], $file) ? 'class="act"' : '' + ); + // Fill the markers in the subpart + $files[] = $this->contentObject->substituteMarkerArray( + $filesSubpart, + $filesMarkers, + '###|###', + 1, + 1 + ); } - $fileList=''.implode('',$lines).'
'; - $fileList.='
('.$EDIT_path.')'; - if ($this->allowFileEditOutsite_typo3conf_dir) { - $fileList.='
- '.PATH_site.' -
'; - } + if ($fileFound && @is_file($this->INSTALL['typo3conf_files'])) { - // create link for deleting temp_CACHED files - $fileList .= '

Delete temp_CACHED* files'; - - if ($fileFound && @is_file($this->INSTALL['typo3conf_files'])) { - $backupFile = $this->getBackupFilename($this->INSTALL['typo3conf_files']); $fileContent = t3lib_div::getUrl($this->INSTALL['typo3conf_files']); - $this->contentBeforeTable.= '
'.(substr($this->INSTALL['typo3conf_files'],-1)!='~' && !strstr($this->INSTALL['typo3conf_files'],'_bak') ? ' -  ' : '').' - -
File: '.$this->INSTALL['typo3conf_files'].' -
MD5-sum: '.md5($fileContent).' -
+ // Get the subpart to edit the files + $fileEditTemplate = $this->contentObject->getSubpart($template, '###FILEEDIT###'); + $allowFileEditOutsideTypo3ConfDirSubPart = ''; - - '.($this->allowFileEditOutsite_typo3conf_dir?'':'').' - -
-
-
- '. - '
'; + if (substr($this->INSTALL['typo3conf_files'], -1) != '~' && !strstr($this->INSTALL['typo3conf_files'], '_bak')) { + // Get the subpart to show the save button + $showSaveButtonSubPart = $this->contentObject->getSubpart($fileEditTemplate, '###SHOWSAVEBUTTON###'); + } + + if ($this->allowFileEditOutsite_typo3conf_dir) { + // Get the subpart to show if files are allowed outside the directory typo3conf + $allowFileEditOutsideTypo3ConfDirSubPart = $this->contentObject->getSubpart($fileEditTemplate, '###ALLOWFILEEDITOUTSIDETYPO3CONFDIR###'); + } + // Substitute the subpart for the save button + $fileEditContent = $this->contentObject->substituteSubpart( + $fileEditTemplate, + '###SHOWSAVEBUTTON###', + $showSaveButtonSubPart + ); + // Substitute the subpart to show if files are allowed outside the directory typo3conf + $fileEditContent = $this->contentObject->substituteSubpart( + $fileEditContent, + '###ALLOWFILEEDITOUTSIDETYPO3CONFDIR###', + $allowFileEditOutsideTypo3ConfDirSubPart + ); + // Define the markers content for subpart to edit the files + $fileEditMarkers = array( + 'messages' => !empty($messages) ? '

' . $messages . '

' : '', + 'action' => $this->action . '#fileEditHeader', + 'saveFile' => 'Save file', + 'close' => 'Close', + 'llEditing' => 'Editing file:', + 'file' => $this->INSTALL['typo3conf_files'], + 'md5Sum' => 'MD5-sum: ' . md5($fileContent), + 'fileName' => $this->INSTALL['typo3conf_files'], + 'fileEditPath' => $this->INSTALL['FILE']['EDIT_path'], + 'filePreviousMd5' => md5($fileContent), + 'fileMd5' => md5($this->INSTALL['typo3conf_files']), + 'fileContent' => t3lib_div::formatForTextarea($fileContent), + 'winToUnixBrChecked' => TYPO3_OS == 'WIN' ? '' : 'checked="checked"', + 'winToUnixBr' => 'Convert Windows linebreaks (13-10) to Unix (10)', + 'backupChecked' => @is_file($backupFile) ? 'checked="checked"' : '', + 'backup' => 'Make backup copy (rename to ' . basename($backupFile) . ')' + ); + // Fill the markers in the subpart to edit the files + $fileEditContent = $this->contentObject->substituteMarkerArray( + $fileEditContent, + $fileEditMarkers, + '###|###', + 1, + 1 + ); } - if ($this->contentBeforeTable) { - $this->contentBeforeTable = $this->fw($this->contentBeforeTable); + if ($this->allowFileEditOutsite_typo3conf_dir) { + // Get the subpart to show if files are allowed outside the directory typo3conf + $allowFileEditOutsideTypo3ConfDirSubPart = $this->contentObject->getSubpart($template, '###ALLOWFILEEDITOUTSIDETYPO3CONFDIR###'); + // Define the markers content + $allowFileEditOutsideTypo3ConfDirMarkers = array( + 'action' => $this->action, + 'pathSite' => PATH_site, + 'editPath' => $this->INSTALL['FILE']['EDIT_path'], + 'set' => 'Set' + ); + // Fill the markers in the subpart + $allowFileEditOutsideTypo3ConfDirSubPart = $this->contentObject->substituteMarkerArray( + $allowFileEditOutsideTypo3ConfDirSubPart, + $allowFileEditOutsideTypo3ConfDirMarkers, + '###|###', + 1, + 1 + ); } - - $this->message($headCode,'Files in folder',$fileList); - + // Substitute the subpart to edit the file + $fileListContent = $this->contentObject->substituteSubpart( + $template, + '###FILEEDIT###', + $fileEditContent + ); + // Substitute the subpart when files can be edited outside typo3conf directory + $fileListContent = $this->contentObject->substituteSubpart( + $fileListContent, + '###ALLOWFILEEDITOUTSIDETYPO3CONFDIR###', + $allowFileEditOutsideTypo3ConfDirSubPart + ); + // Substitute the subpart for the files + $fileListContent = $this->contentObject->substituteSubpart( + $fileListContent, + '###FILES###', + implode(chr(10), $files) + ); + // Define the markers content + $fileListMarkers = array( + 'editPath' => '(' . $EDIT_path . ')', + 'deleteTempCachedUrl' => $this->action . '&TYPO3_INSTALL[delTempCached]=1', + 'deleteTempCached' => 'Delete temp_CACHED* files' + ); + // Fill the markers + $fileListContent = $this->contentObject->substituteMarkerArray( + $fileListContent, + $fileListMarkers, + '###|###', + 1, + 1 + ); + // Add the content to the message array + $this->message($headCode, 'Files in folder', $fileListContent); + // Output the page $this->output($this->outputWrapper($this->printAll())); } /** * Outputs system information * - * @return [type] ... + * @return void */ - function phpinformation() { + function phpinformation() { $headCode = 'PHP information'; $sVar = t3lib_div::getIndpEnv('_ARRAY'); @@ -1030,49 +1530,72 @@ $sVar['OTHER: memory_limit']=ini_get('memory_limit'); $gE_keys = explode(',','SERVER_PORT,SERVER_SOFTWARE,GATEWAY_INTERFACE,SCRIPT_NAME,PATH_TRANSLATED'); - while(list(,$k)=each($gE_keys)) { + foreach ($gE_keys as $k) { $sVar['SERVER: '.$k]=$_SERVER[$k]; } $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'); - while(list(,$k)=each($gE_keys)) { + + foreach ($gE_keys as $k) { $sVar['T3CV_GFX: '.$k]=$GLOBALS['TYPO3_CONF_VARS']['GFX'][$k]; } - $debugInfo=array(); - $debugInfo[]='### DEBUG SYSTEM INFORMATION - START ###'; - reset($sVar); - while(list($kkk,$vvv)=each($sVar)) { + $debugInfo = array( + '### DEBUG SYSTEM INFORMATION - START ###' + ); + foreach ($sVar as $kkk => $vvv) { $debugInfo[]=str_pad(substr($kkk,0,20),20).': '.$vvv; } $debugInfo[]='### DEBUG SYSTEM INFORMATION - END ###'; - - $buf=$this->messageFunc_nl2br; - $this->messageFunc_nl2br=0; - $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!
-
'); - $this->messageFunc_nl2br=$buf; - + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'PhpInformation.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Define the markers content + $markers = array( + 'explanation' => '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!', + 'debugInfo' => t3lib_div::formatForTextarea(implode(chr(10), $debugInfo)) + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $template, + $markers, + '###|###', + 1, + 1 + ); + // Add the content to the message array + $this->message($headCode, 'DEBUG information', $content); + // Start with various server information $getEnvArray = array(); $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'); - while(list(,$k)=each($gE_keys)) { + foreach ($gE_keys as $k) { $getEnvArray[$k] = getenv($k); } - $this->message($headCode,'t3lib_div::getIndpEnv()',t3lib_div::view_array(t3lib_div::getIndpEnv('_ARRAY'))); - $this->message($headCode,'getenv()',t3lib_div::view_array($getEnvArray)); - $this->message($headCode,'_ENV',t3lib_div::view_array($_ENV)); - $this->message($headCode,'_SERVER',t3lib_div::view_array($_SERVER)); - $this->message($headCode,'_COOKIE',t3lib_div::view_array($_COOKIE)); - $this->message($headCode,'_GET',t3lib_div::view_array($_GET)); - + $this->message($headCode, 't3lib_div::getIndpEnv()', $this->viewArray(t3lib_div::getIndpEnv('_ARRAY'))); + $this->message($headCode, 'getenv()', $this->viewArray($getEnvArray)); + $this->message($headCode, '_ENV', $this->viewArray($_ENV)); + $this->message($headCode, '_SERVER', $this->viewArray($_SERVER)); + $this->message($headCode, '_COOKIE', $this->viewArray($_COOKIE)); + $this->message($headCode, '_GET', $this->viewArray($_GET)); + // Start with the phpinfo() part ob_start(); phpinfo(); $contents = explode('',ob_get_contents()); ob_end_clean(); $contents = explode('',$contents[1]); - - $this->message($headCode,'phpinfo()','
' . $contents[0] . '
'); - + // Do code cleaning: phpinfo() is not XHTML1.1 compliant + $phpinfo = str_replace(' + ' . $phpinfo . ' +
+ '); + // Output the page $this->output($this->outputWrapper($this->printAll())); } @@ -1097,22 +1620,36 @@ /** * Provides a tool for deleting temporary files located in typo3temp/ * - * @return string HTML output + * @return void */ - function typo3TempManager() { + function typo3TempManager() { $headCode = 'typo3temp/ directory'; - $this->message($headCode,'What is it?',' - TYPO3 uses this directory for temporary files, mainly processed and cached images. - The filenames are very cryptic; They are unique representations of the file properties made by md5-hashing a serialized array with information. - Anyway this directory may contain many thousand files and a lot of them may be of no use anymore. - - With this test you can delete the files in this folder. When you do that, you should also clear the cache database tables afterwards. + $this->message($headCode, 'What is it?', ' +

+ TYPO3 uses this directory for temporary files, mainly processed + and cached images. +
+ The filenames are very cryptic; They are unique representations + of the file properties made by md5-hashing a serialized array + with information. +
+ Anyway this directory may contain many thousand files and a lot + of them may be of no use anymore. +

+

+ With this test you can delete the files in this folder. When you + do that, you should also clear the cache database tables + afterwards. +

'); - if (!$this->config_array['dir_typo3temp']) { - $this->message('typo3temp/ directory','typo3temp/ not writable!'," - You must make typo3temp/ write enabled before you can proceed with this test. - ",2); + if (!$this->config_array['dir_typo3temp']) { + $this->message('typo3temp/ directory', 'typo3temp/ not writable!', ' +

+ You must make typo3temp/ write enabled before you can + proceed with this test. +

+ ', 2); $this->output($this->outputWrapper($this->printAll())); return; } @@ -1127,14 +1664,14 @@ if (strlen($subdir) && !preg_match('/^[[:alnum:]_]+\/$/',$subdir)) die('subdir "'.$subdir.'" was not allowed!'); $action = $this->INSTALL['typo3temp_action']; $d = @dir($this->typo3temp_path.$subdir); - if (is_object($d)) { + if (is_object($d)) { while($entry=$d->read()) { $theFile = $this->typo3temp_path.$subdir.$entry; - if (@is_file($theFile)) { + if (@is_file($theFile)) { $ok = 0; $fileCounter++; - if ($tt) { - if (t3lib_div::testInt($tt)) { + if ($tt) { + if (t3lib_div::testInt($tt)) { if (filesize($theFile) > $tt*1024) $ok=1; } else { if (fileatime($theFile) < $GLOBALS['EXEC_TIME'] - (intval($tmap[$tt]) * 60 * 60 * 24)) { @@ -1144,10 +1681,11 @@ } else { $ok = 1; } - if ($ok) { + if ($ok) { $hashPart=substr(basename($theFile),-14,10); - if (!preg_match('/[^a-f0-9]/',$hashPart) || substr($theFile,-6)==='.cache' || substr($theFile,-4)==='.tbl' || substr(basename($theFile),0,8)==='install_') { // This is a kind of check that the file being deleted has a 10 char hash in it - if ($action && $deleteCounter<$action) { + // This is a kind of check that the file being deleted has a 10 char hash in it + if (!preg_match('/[^a-f0-9]/',$hashPart) || substr($theFile,-6)==='.cache' || substr($theFile,-4)==='.tbl' || substr(basename($theFile),0,8)==='install_') { + if ($action && $deleteCounter<$action) { $deleteCounter++; unlink($theFile); } else { @@ -1163,10 +1701,10 @@ // Find sub-dirs: $subdirRegistry = array(''=>''); $d = @dir($this->typo3temp_path); - if (is_object($d)) { + if (is_object($d)) { while($entry=$d->read()) { $theFile = $entry; - if (@is_dir($this->typo3temp_path.$theFile) && $theFile!='..' && $theFile!='.') { + if (@is_dir($this->typo3temp_path.$theFile) && $theFile!='..' && $theFile!='.') { $subdirRegistry[$theFile.'/'] = $theFile.'/ (Files: '.count(t3lib_div::getFilesInDir($this->typo3temp_path.$theFile)).')'; } } @@ -1188,49 +1726,122 @@ '500' => 'Delete 500', '1000' => 'Delete 1000' ); + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'Typo3TempManager.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Get the subpart for 'Delete files by condition' dropdown + $deleteOptionsSubpart = $this->contentObject->getSubpart($template, '###DELETEOPTIONS###'); + $deleteOptions = array(); - $content=' -
-Number of files at a time: - + foreach ($deleteType as $deleteKey => $deleteValue) { + // Define the markers content + $deleteMarkers = array( + 'value' => htmlspecialchars($deleteKey), + 'selected' => !strcmp($deleteKey, $tt) ? 'selected="selected"' : '', + 'data' => htmlspecialchars($deleteValue) + ); + // Fill the markers in the subpart + $deleteOptions[] = $this->contentObject->substituteMarkerArray( + $deleteOptionsSubpart, + $deleteMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for 'Delete files by condition' dropdown + $content = $this->contentObject->substituteSubpart( + $template, + '###DELETEOPTIONS###', + implode(chr(10), $deleteOptions) + ); + // Get the subpart for 'Number of files at a time' dropdown + $actionOptionsSubpart = $this->contentObject->getSubpart($template, '###ACTIONOPTIONS###'); + $actionOptions = array(); -From sub-directory: - - '; + foreach ($actionType as $actionKey => $actionValue) { + // Define the markers content + $actionMarkers = array( + 'value' => htmlspecialchars($actionKey), + 'data' => htmlspecialchars($actionValue) + ); + // Fill the markers in the subpart + $actionOptions[] = $this->contentObject->substituteMarkerArray( + $actionOptionsSubpart, + $actionMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for 'Number of files at a time' dropdown + $content = $this->contentObject->substituteSubpart( + $content, + '###ACTIONOPTIONS###', + implode(chr(10), $actionOptions) + ); + // Get the subpart for 'From sub-directory' dropdown + $subDirectoryOptionsSubpart = $this->contentObject->getSubpart($template, '###SUBDIRECTORYOPTIONS###'); + $subDirectoryOptions = array(); - $form = '
'.$content.' - - -
- This tool will delete files only if the last 10 characters before the extension (3 chars+\'.\') are hexadecimal valid ciphers, which are lowercase a-f and 0-9.'; - - $this->message($headCode,'Statistics',' - Number of temporary files: '.($fileCounter-$deleteCounter)." - Number matching '".htmlspecialchars($deleteType[$tt])."': ".$criteriaMatch.' - Number deleted: '.$deleteCounter.' -
- '.$form,1); - + foreach ($subdirRegistry as $subDirectoryKey => $subDirectoryValue) { + // Define the markers content + $subDirectoryMarkers = array( + 'value' => htmlspecialchars($subDirectoryKey), + 'selected' => !strcmp($subDirectoryKey, $this->INSTALL['typo3temp_subdir']) ? 'selected="selected"' : '', + 'data' => htmlspecialchars($subDirectoryValue) + ); + // Fill the markers in the subpart + $subDirectoryOptions[] = $this->contentObject->substituteMarkerArray( + $subDirectoryOptionsSubpart, + $subDirectoryMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for 'From sub-directory' dropdown + $content = $this->contentObject->substituteSubpart( + $content, + '###SUBDIRECTORYOPTIONS###', + implode(chr(10), $subDirectoryOptions) + ); + // Define the markers content + $markers = array( + 'numberTemporary' => 'Number of temporary files:', + 'numberMatching' => 'Number matching:', + 'numberDeleted' => 'Number deleted:', + 'temporary' => ($fileCounter - $deleteCounter), + 'matching' => $criteriaMatch, + 'deleteType' => '' . htmlspecialchars($deleteType[$tt]) . '', + 'deleted' => $deleteCounter, + 'deleteCondition' => 'Delete files by condition', + 'numberFiles' => 'Number of files at a time:', + 'fromSubdirectory' => 'From sub-directory:', + 'execute' => 'Execute', + 'explanation' => ' +

+ This tool will delete files only if the last 10 characters + before the extension (3 chars+\'.\') are hexadecimal valid + ciphers, which are lowercase a-f and 0-9. +

+ ' + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $content, + $markers, + '###|###', + 1, + 1 + ); + // Add the content to the message array + $this->message($headCode, 'Statistics', $content, 1); + // Output the page $this->output($this->outputWrapper($this->printAll())); } - /** - * [Describe function...] - * - * @param [type] $deleteType: ... - * @param [type] $tt: ... - * @return [type] ... - */ - function getSelectorOptions($deleteType,$tt='') { - $out=''; - if (is_array($deleteType)) { - reset($deleteType); - while(list($v,$l)=each($deleteType)) { - $out.=''; - } - } - return $out; - } @@ -1239,7 +1850,6 @@ - /******************************* * * cleanup manager @@ -1249,19 +1859,30 @@ /** * Provides a tool cleaning up various tables in the database * - * @return string HTML output - * @author Robert Lemke - * @todo Add more functionality ... + * @return void + * @author Robert Lemke + * @todo Add more functionality ... */ - function cleanupManager() { + function cleanupManager() { $headCode = 'Clean up database'; - $this->message($headCode,'What is it?',' - This function will become a general clean up manager for various tables used by TYPO3. By now you can only empty the cache which is used for storing image sizes of all pictures used in TYPO3. - - Clear cached image sizes - Clears the cache used for memorizing sizes of all images used in your website. This information is cached in order to gain performance and will be stored each time a new image is being displayed in the frontend. - - You should Clear All Cache in the backend after clearing this cache. + $this->message($headCode, 'What is it?', ' +

+ This function will become a general clean up manager for various + tables used by TYPO3. By now you can only empty the cache which + is used for storing image sizes of all pictures used in TYPO3. +

+

+ Clear cached image sizes +
+ Clears the cache used for memorizing sizes of all images used in + your website. This information is cached in order to gain + performance and will be stored each time a new image is being + displayed in the frontend. +

+

+ You should Clear All Cache in the backend after + clearing this cache. +

'); $tables = $this->getListOfTables(); @@ -1280,18 +1901,63 @@ $cleanupType['cache_imagesizes'] = 'Clear cached image sizes only'; $cachedImageSizesCounter = intval($GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'cache_imagesizes')); } 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); + $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'; } + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'CleanUpManager.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Get the subpart for the 'Clean up' dropdown + $cleanUpOptionsSubpart = $this->contentObject->getSubpart($template, '###CLEANUPOPTIONS###'); + $cleanUpOptions = array(); - $content = ' '; - $form = '
'.$content.'
'; - $this->message($headCode,'Statistics',' - Number cached image sizes: '.$cachedImageSizesCounter.'
- '.$form,1); - + foreach ($cleanupType as $cleanUpKey => $cleanUpValue) { + // Define the markers content + $cleanUpMarkers = array( + 'value' => htmlspecialchars($cleanUpKey), + 'data' => htmlspecialchars($cleanUpValue) + ); + // Fill the markers in the subpart + $cleanUpOptions[] = $this->contentObject->substituteMarkerArray( + $cleanUpOptionsSubpart, + $cleanUpMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for the 'Clean up' dropdown + $content = $this->contentObject->substituteSubpart( + $template, + '###CLEANUPOPTIONS###', + implode(chr(10), $cleanUpOptions) + ); + // Define the markers content + $markers = array( + 'numberCached' => 'Number cached image sizes:', + 'number' => $cachedImageSizesCounter, + 'action' => $this->action, + 'cleanUp' => 'Clean up', + 'execute' => 'Execute' + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $content, + $markers, + '###|###', + 1, + 1 + ); + // Add the content to the message array + $this->message($headCode, 'Statistics', $content, 1); + // Output the page $this->output($this->outputWrapper($this->printAll())); } @@ -1316,69 +1982,160 @@ /** * Creating the form for editing the TYPO3_CONF_VARS options. * - * @param [type] $type: ... - * @return [type] ... + * @param string $type If get_form, display form, otherwise checks and store in localconf.php + * @return void */ - function generateConfigForm($type='') { + function generateConfigForm($type='') { $default_config_content = t3lib_div::getUrl(PATH_t3lib.'config_default.php'); $commentArr = $this->getDefaultConfigArrayComments($default_config_content); - switch($type) { + switch($type) { case 'get_form': - reset($GLOBALS['TYPO3_CONF_VARS']); - $this->messageFunc_nl2br=0; - while(list($k,$va)=each($GLOBALS['TYPO3_CONF_VARS'])) { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'GenerateConfigForm.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + + foreach ($GLOBALS['TYPO3_CONF_VARS'] as $k => $va) { $ext='['.$k.']'; $this->message($ext, '$TYPO3_CONF_VARS[\''.$k.'\']',$commentArr[0][$k],1); - while(list($vk,$value)=each($va)) { + foreach ($va as $vk => $value) { + $textAreaSubpart = ''; + $booleanSubpart = ''; + $textLineSubpart = ''; + $description = trim($commentArr[1][$k][$vk]); $isTextarea = preg_match('/^string \(textarea\)/i',$description) ? TRUE : FALSE; $doNotRender = preg_match('/^string \(exclude\)/i', $description) ? TRUE : FALSE; if (!is_array($value) && !$doNotRender && ($this->checkForBadString($value) || $isTextarea)) { $k2 = '['.$vk.']'; - $msg = htmlspecialchars($description).'

'.$ext.$k2.' = '.htmlspecialchars(t3lib_div::fixed_lgd_cs($value,60)).'
'; - if ($isTextarea) { - $form = ''; + if ($isTextarea) { + // Get the subpart for a textarea + $textAreaSubpart = $this->contentObject->getSubpart($template, '###TEXTAREA###'); + // Define the markers content + $textAreaMarkers = array( + 'id' => $k . '-' . $vk, + 'name' => 'TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']', + 'value' => $value + ); + // Fill the markers in the subpart + $textAreaSubpart = $this->contentObject->substituteMarkerArray( + $textAreaSubpart, + $textAreaMarkers, + '###|###', + 1, + 0 + ); } elseif (preg_match('/^boolean/i',$description)) { - $form = ''; - $form.= ''; + // Get the subpart for a checkbox + $booleanSubpart = $this->contentObject->getSubpart($template, '###BOOLEAN###'); + // Define the markers content + $booleanMarkers = array( + 'id' => $k . '-' . $vk, + 'name' => 'TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']', + 'value' => $value && strcmp($value, '0') ? $value : 1, + 'checked' => $value ? 'checked="checked"' : '' + ); + // Fill the markers in the subpart + $booleanSubpart = $this->contentObject->substituteMarkerArray( + $booleanSubpart, + $booleanMarkers, + '###|###', + 1, + 0 + ); } else { - $form = ''; + // Get the subpart for an input text field + $textLineSubpart = $this->contentObject->getSubpart($template, '###TEXTLINE###'); + // Define the markers content + $textLineMarkers = array( + 'id' => $k . '-' . $vk, + 'name' => 'TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']', + 'value' => $value + ); + // Fill the markers in the subpart + $textLineSubpart = $this->contentObject->substituteMarkerArray( + $textLineSubpart, + $textLineMarkers, + '###|###', + 1, + 0 + ); } - $this->message($ext, $k2,$msg.$form); + // Substitute the subpart for a textarea + $content = $this->contentObject->substituteSubpart( + $template, + '###TEXTAREA###', + $textAreaSubpart + ); + // Substitute the subpart for a checkbox + $content = $this->contentObject->substituteSubpart( + $content, + '###BOOLEAN###', + $booleanSubpart + ); + // Substitute the subpart for an input text field + $content = $this->contentObject->substituteSubpart( + $content, + '###TEXTLINE###', + $textLineSubpart + ); + // Define the markers content + $markers = array( + 'description' => htmlspecialchars($description), + 'key' => '[' . $k . '][' . $vk . ']', + 'label' => htmlspecialchars(t3lib_div::fixed_lgd_cs($value, 40)) + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $content, + $markers, + '###|###', + 1, + 1 + ); + // Add the content to the message array + $this->message($ext, $k2, $content); } } } break; default: - if (is_array($this->INSTALL['extConfig'])) { - reset($this->INSTALL['extConfig']); + if (is_array($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])) { + foreach ($this->INSTALL['extConfig'] as $k => $va) { + if (is_array($GLOBALS['TYPO3_CONF_VARS'][$k])) { + foreach ($va as $vk => $value) { + 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))) { + 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.'); + $this->errorMessages[] = ' + 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 (preg_match('/^string \(textarea\)/i', $description)) { + // Force Unix linebreaks in textareas + $value = str_replace(chr(13),'',$value); + // Preserve linebreaks + $value = str_replace(chr(10),"'.chr(10).'",$value); } if (preg_match('/^boolean/i', $description)) { - // When submitting settings in the Install Tool, values that default to "false" or "true" in config_default.php will be sent as "0" resp. "1". Therefore, reset the values to their boolean equivalent. + // When submitting settings in the Install Tool, values that default to "false" or "true" + // in config_default.php will be sent as "0" resp. "1". Therefore, reset the values + // to their boolean equivalent. if ($GLOBALS['TYPO3_CONF_VARS'][$k][$vk] === false && $value === '0') { $value = false; } elseif ($GLOBALS['TYPO3_CONF_VARS'][$k][$vk] === true && $value === '1') { @@ -1398,27 +2155,27 @@ } /** - * [Describe function...] + * Make an array of the comments in the t3lib/config_default.php file * - * @param [type] $string: ... - * @param [type] $mainArray: ... - * @param [type] $commentArray: ... - * @return [type] ... + * @param string $string The contents of the config_default.php file + * @param array $mainArray + * @param array $commentArray + * @return array */ - function getDefaultConfigArrayComments($string,$mainArray=array(),$commentArray=array()) { + function getDefaultConfigArrayComments($string,$mainArray=array(),$commentArray=array()) { $lines = explode(chr(10),$string); $in=0; $mainKey=''; - while(list(,$lc)=each($lines)) { + foreach ($lines as $lc) { $lc = trim($lc); if ($in) { - if (!strcmp($lc,');')) { + if (!strcmp($lc,');')) { $in=0; } else { - if (preg_match('/["\']([[:alnum:]_-]*)["\'][[:space:]]*=>(.*)/i',$lc,$reg)) { + 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]))) { + if (substr(strtolower(trim($reg[2])),0,5)=='array' && !strcmp($reg[1],strtoupper($reg[1]))) { $mainKey=trim($reg[1]); $mainArray[$mainKey]=$theComment; } elseif ($mainKey) { @@ -1455,9 +2212,9 @@ /** * Checking php.ini configuration and set appropriate messages and flags. * - * @return [type] ... + * @return void */ - function checkConfiguration() { + function checkConfiguration() { $ext='php.ini configuration checked'; $this->message($ext); @@ -1467,74 +2224,137 @@ // 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!'," - include_path=".ini_get('include_path')." - 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); + if (!in_array('.',$incPaths)) { + $this->message($ext, 'Current directory (./) is not in include path!', ' +

+ include_path=' . ini_get('include_path') . ' +
+ 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'," - file_uploads=".ini_get('file_uploads')." - 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); + if (!ini_get('file_uploads')) { + $this->message($ext, 'File uploads not allowed', ' +

+ file_uploads=' . ini_get('file_uploads') . ' +
+ 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?'," - upload_max_filesize=".ini_get('upload_max_filesize')." - 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. - Notice: 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); + $upload_max_filesize = t3lib_div::getBytesFromSizeMeasurement(ini_get('upload_max_filesize')); + $post_max_size = t3lib_div::getBytesFromSizeMeasurement(ini_get('post_max_size')); + if ($upload_max_filesize<1024*1024*10) { + $this->message($ext, 'Maximum upload filesize too small?', ' +

+ upload_max_filesize=' . ini_get('upload_max_filesize') . ' +
+ 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. +
+ Notice: 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',' - upload_max_filesize='.ini_get('upload_max_filesize').', post_max_size='.ini_get('post_max_size').' - 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); + if ($upload_max_filesize > $post_max_size) { + $this->message($ext, 'Maximum size for POST requests is smaller than max. upload filesize', ' +

+ upload_max_filesize=' . ini_get('upload_max_filesize') . ' + , post_max_size=' . ini_get('post_max_size') . ' +
+ 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')); + $memory_limit_value = t3lib_div::getBytesFromSizeMeasurement(ini_get('memory_limit')); if ($memory_limit_value && $memory_limit_value < t3lib_div::getBytesFromSizeMeasurement(TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT)) { - $this->message($ext, 'Memory limit below ' . TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT,' - memory_limit=' . ini_get('memory_limit') . ' - Your system is configured to enforce a memory limit of PHP scripts lower than ' . TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT . '. 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 ' . TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT . '. - ',3); + $this->message($ext, 'Memory limit below ' . TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT, ' +

+ memory_limit=' . ini_get('memory_limit') . ' +
+ Your system is configured to enforce a memory limit of PHP + scripts lower than ' . TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT . '. + 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 + ' . TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT . '. +

+ ', 3); } elseif(!$memory_limit_value) { - $this->message($ext, 'Memory limit',"No memory limit in effect.",-1); - } else $this->message($ext, 'Memory limit',"memory_limit=".ini_get('memory_limit')."",-1); - if (ini_get('max_execution_time')<30) { - $this->message($ext, 'Maximum execution time below 30 seconds'," - max_execution_time=".ini_get('max_execution_time')." - May impose problems if too low. - ",1); + $this->message($ext, 'Memory limit', ' +

+ No memory limit in effect. +

+ ', -1); } else { - $this->message($ext, 'Maximum execution time',"max_execution_time=".ini_get('max_execution_time')."",-1); + $this->message($ext, 'Memory limit: ' . ini_get('memory_limit'), '', -1); } - if (ini_get('disable_functions')) { - $this->message($ext, 'Functions disabled!'," - disable_functions=".ini_get('disable_functions')." - 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 exec() which is use by TYPO3 to access ImageMagick. - ",2); + if (ini_get('max_execution_time')<30) { + $this->message($ext, 'Maximum execution time below 30 seconds', ' +

+ max_execution_time=' . ini_get('max_execution_time') . ' +
+ May impose problems if too low. +

+ ', 1); } else { - $this->message($ext, 'Functions disabled: none',"",-1); + $this->message($ext, 'Maximum execution time: ' . ini_get('max_execution_time') . ' seconds', '', -1); } + if (ini_get('disable_functions')) { + $this->message($ext, 'Functions disabled!', ' +

+ disable_functions=' . ini_get('disable_functions') . ' +
+ 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 + exec() which is use by TYPO3 to access ImageMagick. +

+ ', 2); + } else { + $this->message($ext, 'Functions disabled: none', '', -1); + } // Mail tests if (TYPO3_OS == 'WIN') { $smtp = ini_get('SMTP'); @@ -1547,116 +2367,220 @@ $smtp_addr = $smtp; } if (!$smtp || $bad_smtp || !t3lib_div::testInt(ini_get('smtp_port'))) { - $this->message($ext, 'Mail configuration is not set correctly',' - Mail configuration is not set - PHP mail() function requires SMTP and smtp_port to have correct values on Windows.', - 2); + $this->message($ext, 'Mail configuration is not set correctly', ' +

+ Mail configuration is not set +
+ PHP mail() function requires SMTP and smtp_port to have + correct values on Windows. +

+ ', 2); } else { if (($smtp_addr == '127.0.0.1' || $smtp_addr == '::1') && ($_SERVER['SERVER_ADDR'] == '127.0.0.1' || $_SERVER['SERVER_ADDR'] == '::1')) { - $this->message($ext, 'Mail is configured (potential problem exists!)', - 'SMTP=' . $smtp . ' - Note: this server! Are you sure it runs SMTP server? - smtp_port=' . ini_get('smtp_port') . ' - '.$this->check_mail('get_form'), 1); + $this->message($ext, 'Mail is configured (potential problem exists!)', ' +

+ SMTP=' . $smtp . ' - Note: + this server! Are you sure it runs SMTP server? +
+ smtp_port=' . ini_get('smtp_port') . ' +

' . $this->check_mail('get_form') . ' + ', 1); } else { - $this->message($ext, 'Mail is configured', - 'SMTP=' . $smtp . ' - smtp_port=' . ini_get('smtp_port') . ' - '.$this->check_mail('get_form'), -1); + $this->message($ext, 'Mail is configured', ' +

+ SMTP=' . $smtp . ' +
+ smtp_port=' . ini_get('smtp_port') . ' +

' . $this->check_mail('get_form') .' + ', -1); } } } elseif (!ini_get('sendmail_path')) { - $this->message($ext, 'Sendmail path not defined!',' - 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); + $this->message($ext, 'Sendmail path not defined!', ' +

+ 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 (!@is_executable($prg)) { - $this->message($ext, 'Sendmail program not found or not executable?',' - sendmail_path=' . ini_get('sendmail_path') . ' - 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); + $this->message($ext, 'Sendmail program not found or not executable?', ' +

+ sendmail_path=' . ini_get('sendmail_path') . ' +
+ 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',' - sendmail_path=' . ini_get('sendmail_path') . ' - '.$this->check_mail('get_form'),-1); + $this->message($ext, 'Sendmail OK', ' +

+ sendmail_path=' . ini_get('sendmail_path') . ' +

' . $this->check_mail('get_form') . ' + ', -1); } } // ***************** // Safe mode related // ***************** - if (ini_get('safe_mode')) { - $this->message($ext, 'Safe mode turned on'," - safe_mode=".ini_get('safe_mode')." - 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 may be 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. - - safe_mode_exec_dir=".ini_get('safe_mode_exec_dir')." - 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) - - + if (ini_get('safe_mode')) { + $this->message($ext, 'Safe mode turned on', ' +

+ safe_mode=' . ini_get('safe_mode') . ' +
+ 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 + may be 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. +

+

+ safe_mode_exec_dir=' . ini_get('safe_mode_exec_dir') . ' +
+ 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) +

+

Example of safe_mode settings: +
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. - +
+ 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. +

+

Notice: - 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'," - doc_root=".ini_get('doc_root')." - PHP cannot execute scripts outside this directory. If that is a problem is please correct it. - ",1); +
+ 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', ' +

+ doc_root=' . ini_get('doc_root') . ' +
+ 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_mode')) { - $this->message($ext, 'sql.safe_mode is enabled'," - sql.safe_mode=".ini_get('sql.safe_mode').' - This means that you can only connect to the database with a username corresponding to the user of the webserver process or fileowner. Consult your ISP for information about this. Also see '.$this->linkIt('http://www.wrox.com/Consumer/Store/Books/2963/29632002.htm').' - The owner of the current file is: '.get_current_user ()." - ",1); + } else { + $this->message($ext, 'safe_mode: off',"",-1); + } + if (ini_get('sql.safe_mode')) { + $this->message($ext, 'sql.safe_mode is enabled', ' +

+ sql.safe_mode=' . ini_get('sql.safe_mode') . ' +
+ This means that you can only connect to the database with a + username corresponding to the user of the webserver process + or fileowner. Consult your ISP for information about this. + Also see + http://www.wrox.com/Consumer/Store/Books/2963/29632002.htm +
+ The owner of the current file is: + ' . get_current_user () . ' +

+ ', 1); $this->config_array['sql.safe_mode_user'] = get_current_user(); - } else $this->message($ext, 'sql.safe_mode: off',"",-1); - if (ini_get('open_basedir')) { - $this->message($ext, 'open_basedir set'," - open_basedir=".ini_get('open_basedir')." - This restricts TYPO3 to open and include files only in this path. Please make sure that this does not prevent TYPO3 from running. - Notice (UNIX): Before checking a path according to open_basedir, PHP resolves all symbolic links. - ",1); -// ???? If this option was set falsely you probably didn't see this page in the first place, but this option may spoil this configuration test when checking for such as ImageMagick executables. - } else $this->message($ext, 'open_basedir: off',"",-1); + } else { + $this->message($ext, 'sql.safe_mode: off',"",-1); + } + if (ini_get('open_basedir')) { + $this->message($ext, 'open_basedir set', ' +

+ open_basedir=' . ini_get('open_basedir') . ' +
+ This restricts TYPO3 to open and include files only in this + path. Please make sure that this does not prevent TYPO3 from + running. +
+ Notice (UNIX): Before checking a path + according to open_basedir, PHP resolves all symbolic links. +

+ ', 1); + // ???? If this option was set falsely you probably didn't see this page in the + // first place, but this option may spoil this configuration test + // when checking for such as ImageMagick executables. + } else { + $this->message($ext, 'open_basedir: off',"",-1); + } // Check availability of PHP session support if (extension_loaded('session')) { - $this->message($ext, 'PHP sessions availiable',' - PHP Sessions availiabe - PHP is compiled with session support and session support is available. - ',-1); + $this->message($ext, 'PHP sessions availiable', ' +

+ PHP Sessions availiabe +
+ PHP is compiled with session support and session support is + available. +

+ ', -1); } else { - $this->message($ext, 'PHP Sessions not availiabe',' - PHP is not compiled with session support, or session support is disabled in php.ini. - TYPO3 needs session support - ',3); + $this->message($ext, 'PHP Sessions not availiabe', ' +

+ PHP is not compiled with session support, or session support + is disabled in php.ini. +
+ TYPO3 needs session support +

+ ', 3); } - // Suhosin/Hardened PHP: - $suhosinDescription = 'Suhosin limits the number of elements that can be submitted in forms to the server. ' . - 'This will affect for example the "All configuration" section in the Install Tool or Inline Relational ' . - 'Record Editing (IRRE) with many child records.'; + // Suhosin/Hardened PHP: + $suhosinDescription = ' +

+ Suhosin limits the number of elements that can be submitted in + forms to the server. This will affect for example the + "All configuration" section in the Install Tool or Inline + Relational Record Editing (IRRE) with many child records. +

'; if (extension_loaded('suhosin')) { - $suhosinSuggestion = 'At least a value of 400 is suggested.'; + $suhosinSuggestion = ' +

+ At least a value of 400 is suggested. +

+ '; $suhosinRequestMaxVars = ini_get('suhosin.request.max_vars'); $suhosinPostMaxVars = ini_get('suhosin.post.max_vars'); @@ -1674,13 +2598,24 @@ // Check for stripped PHPdoc comments that are required to evaluate annotations: $method = new ReflectionMethod('tx_install', 'check_mail'); if (strlen($method->getDocComment()) === 0) { - $description = 'The system extension Extbase evaluates annotations in PHPdoc comments ' . - 'and thus requires eAccelerator not to strip away these parts. However, this is currently ' . - 'the only part in the TYPO3 Core (beside deprecation log and unit tests). If Extbase is not ' . - 'used, recompiling eAccelerator is not required at all.

' . - 'If you do not want comments to be stripped by eAccelerator, please recompile with the following ' . - 'configuration setting (more details):
' . - '--with-eaccelerator-doc-comment-inclusion'; + $description = ' +

+ The system extension Extbase evaluates annotations in PHPdoc + comments and thus requires eAccelerator not to strip away + these parts. However, this is currently the only part in the + TYPO3 Core (beside deprecation log and unit tests). If + Extbase is not used, recompiling eAccelerator is not + required at all. +
+
+ If you do not want comments to be stripped by eAccelerator, + please recompile with the following configuration setting + ( + more details): +
+ --with-eaccelerator-doc-comment-inclusion +

+ '; $this->message($ext, 'PHPdoc comments are stripped', $description, 2); } } @@ -1688,23 +2623,65 @@ /** * Check if PHP function mail() works * - * @param string $cmd If "get_form" then a formfield for the mail-address is shown. If not, it's checked if "check_mail" was in the INSTALL array and if so a test mail is sent to the recipient given. - * @return [type] ... + * @param string $cmd If "get_form" then a formfield for the mail-address is shown. If not, it's checked if "check_mail" was in the INSTALL array and if so a test mail is sent to the recipient given. + * @return string The mail form if it is requested with get_form */ - function check_mail($cmd='') { - switch($cmd) { + function check_mail($cmd='') { + switch($cmd) { case 'get_form': - $out=' - You can check the mail() function by entering your email address here and press the button. You should then receive a testmail from test@test.test.
Since almost all mails in TYPO3 are sent using the t3lib_htmlmail class, sending with this class can be tested by checking the box Test t3lib_htmlmail below. The return-path of the mail is set to null@'.t3lib_div::getIndpEnv('HTTP_HOST').'. Some mail servers won\'t send the mail if the host of the return-path is not resolved correctly. -

-
'; + $out = ' +

+ You can check the mail() function by entering your email + address here and press the button. You should then + receive a testmail from test@test.test. +
+ Since almost all mails in TYPO3 are sent using the + t3lib_htmlmail class, sending with this class can be + tested by checking the box + Test t3lib_htmlmail below. + The return-path of the mail is set to null@' . t3lib_div::getIndpEnv('HTTP_HOST') . '. + Some mail servers won\'t send the mail if the host of + the return-path is not resolved correctly. +

+ '; + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'CheckMail.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + + if (!empty($this->mailMessage)) { + // Get the subpart for the mail is sent message + $mailSentSubpart = $this->contentObject->getSubpart($template, '###MAILSENT###'); + } + // Substitute the subpart for the mail is sent message + $template = $this->contentObject->substituteSubpart( + $template, + '###MAILSENT###', + $mailSentSubpart + ); + // Define the markers content + $markers = array( + 'message' => $this->mailMessage, + 'enterEmail' => 'Enter the email address', + 'actionUrl' => $this->action . '#checkMailForm', + 'useHtmlMailLabel' => 'Test t3lib_htmlmail', + 'submit' => 'Send test mail' + ); + // Fill the markers + $out .= $this->contentObject->substituteMarkerArray( + $template, + $markers, + '###|###', + 1, + 1 + ); break; default: - if (trim($this->INSTALL['check_mail'])) { + if (trim($this->INSTALL['check_mail'])) { $subject = 'TEST SUBJECT'; $email = trim($this->INSTALL['check_mail']); - if($this->INSTALL['use_htmlmail']) { + if($this->INSTALL['use_htmlmail']) { $emailObj = t3lib_div::makeInstance('t3lib_htmlmail'); /* @var $emailObj t3lib_htmlmail */ $emailObj->start(); @@ -1718,7 +2695,7 @@ } else { t3lib_div::plainMailEncoded($email,$subject,'TEST CONTENT','From: test@test.test'); } - $this->messages[]= 'MAIL WAS SENT TO: '.$email; + $this->mailMessage= 'Mail was sent to: ' . $email; } break; } @@ -1728,14 +2705,14 @@ /** * Checking php extensions, specifically GDLib and Freetype * - * @return [type] ... + * @return void */ - function checkExtensions() { + function checkExtensions() { $ext = 'GDLib'; $this->message($ext); $software_info=1; - if (extension_loaded('gd') && $this->isGD()) { + if (extension_loaded('gd') && $this->isGD()) { $this->config_array['gd']=1; $this->message($ext, 'GDLib found',"",-1); if ($this->isPNG()) { @@ -1750,49 +2727,109 @@ $this->config_array['gd_jpg']=1; $this->message($ext, 'JPG supported (not used by TYPO3)',''); } - if (!$this->config_array['gd_gif'] && !$this->config_array['gd_png']) { - $this->message($ext, 'PNG or GIF not supported', nl2br(trim(' - Your GDLib supports either GIF nor PNG. It must support either one of them. - ')), 2); + if (!$this->config_array['gd_gif'] && !$this->config_array['gd_png']) { + $this->message($ext, 'PNG or GIF not supported', ' +

+ Your GDLib supports either GIF nor PNG. It must support + either one of them. +

+ ', 2); } else { $msg=array(); if ($this->config_array['gd_gif'] && $this->config_array['gd_png']) { - $msg[0]='You can choose between generating GIF or PNG files, as your GDLib supports both.'; + $msg[] = ' +

+ You can choose between generating GIF or PNG files, + as your GDLib supports both. +

+ '; } if ($this->config_array['gd_gif']) { - $msg[10]="You should watch out for the generated size of the GIF-files because some versions of the GD library do not compress them with LZW, but RLE and ImageMagick is subsequently used to compress with LZW. But in the case of ImageMagick failing this task (eg. not being compiled with LZW which is the case with some versions) you'll end up with GIF-filesizes all too big! - This install tool tests what kinds of GIF compression are available in the ImageMagick installations by a physical test. You can also check it manually by opening a TYPO3 generated gif-file with Photoshop and save it in a new file. If the file sizes of the original and the new file are almost the same, you're having LZW compression and everything is fine."; + $msg[] = ' +

+ You should watch out for the generated size of the + GIF-files because some versions of the GD library do + not compress them with LZW, but RLE and ImageMagick + is subsequently used to compress with LZW. But in + the case of ImageMagick failing this task (eg. not + being compiled with LZW which is the case with some + versions) you\'ll end up with GIF-filesizes all too + big! +
+ This install tool tests what kinds of GIF + compression are available in the ImageMagick + installations by a physical test. You can also check + it manually by opening a TYPO3 generated gif-file + with Photoshop and save it in a new file. If the + file sizes of the original and the new file are + almost the same, you\'re having LZW compression and + everything is fine. +

+ '; } if ($this->config_array['gd_png']) { - $msg[20]='TYPO3 prefers the use of GIF-files and most likely your visitors on your website does too as not all browsers support PNG yet.'; + $msg[] = ' +

+ TYPO3 prefers the use of GIF-files and most likely + your visitors on your website does too as not all + browsers support PNG yet. +

+ '; } - $this->message($ext, 'GIF / PNG issues', nl2br(trim(implode($msg,chr(10)))), 1); + $this->message($ext, 'GIF / PNG issues', implode($msg, chr(10)), 1); } - if (!$this->isTTF()) { - $this->message($ext, 'FreeType is apparently not installed', " - It looks like the FreeType library is not compiled into GDLib. This is required when TYPO3 uses GDLib and you'll most likely get errors like 'ImageTTFBBox is not a function' or 'ImageTTFText is not a function'. - ", 2); + if (!$this->isTTF()) { + $this->message($ext, 'FreeType is apparently not installed', ' +

+ It looks like the FreeType library is not compiled into + GDLib. This is required when TYPO3 uses GDLib and + you\'ll most likely get errors like \'ImageTTFBBox is + not a function\' or \'ImageTTFText is not a function\'. +

+ ', 2); } else { - $this->message($ext, 'FreeType quick-test ('.($this->isGIF()?'as GIF':'as PNG').')', '
(If the text is exceeding the image borders you are using Freetype 2 and need to set TYPO3_CONF_VARS[GFX][TTFdpi]=96.
If there is no image at all Freetype is most likely NOT available and you can just as well disable GDlib for TYPO3...)', -1); + $this->message($ext, 'FreeType quick-test (' . ($this->isGIF() ? 'as GIF' : 'as PNG') . ')', ' +

+ +
+ (If the text is exceeding the image borders you are + using Freetype 2 and need to set + TYPO3_CONF_VARS[GFX][TTFdpi]=96. +
+ If there is no image at all Freetype is most likely NOT + available and you can just as well disable GDlib for + TYPO3...) +

+ ', -1); $this->config_array['freetype']=1; } } else { - $this->message($ext, 'GDLib not found', " - GDLib is required if you want to use the GIFBUILDER object in TypoScript. GIFBUILDER is in charge of all advanced image generation in TypoScript, including graphical menuitems. - GDLib is also used in the TYPO3 Backend (TBE) to generate record icons and new module tabs. - It's highly recommended to install this library. Remember to compile GD with FreeType which is also required. - If you choose not to install GDLib, you can disable it in the configuration with [GFX][gdlib]=0;. - ", 2); + $this->message($ext, 'GDLib not found', ' +

+ GDLib is required if you want to use the GIFBUILDER object + in TypoScript. GIFBUILDER is in charge of all advanced image + generation in TypoScript, including graphical menuitems. +
+ GDLib is also used in the TYPO3 Backend (TBE) to generate + record icons and new module tabs. +
+ It\'s highly recommended to install this library. Remember + to compile GD with FreeType which is also required. +
+ If you choose not to install GDLib, you can disable it in + the configuration with [GFX][gdlib]=0;. +

+ ', 2); } - $this->message($ext, 'GDLib software information', nl2br(trim($this->getGDSoftwareInfo()))); + $this->message($ext, 'GDLib software information', $this->getGDSoftwareInfo()); } /** * Checking and testing that the required writable directories are writable. * - * @return [type] ... + * @return void */ - function checkDirs() { + function checkDirs() { // Check typo3/temp/ $ext='Directories'; $this->message($ext); @@ -1825,42 +2862,52 @@ $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . '_temp_/' => array('Typical temporary location for default upload of files by administrators.',0), ); - foreach ($checkWrite as $relpath => $descr) { + foreach ($checkWrite as $relpath => $descr) { // Check typo3temp/ $general_message = $descr[0]; - if (!@is_dir(PATH_site.$relpath)) { // If the directory is missing, try to create it + // If the directory is missing, try to create it + if (!@is_dir(PATH_site.$relpath)) { t3lib_div::mkdir(PATH_site.$relpath); } - if (!@is_dir(PATH_site.$relpath)) { - if ($descr[1]) { // required... - $this->message($ext, $relpath.' directory does not exist and could not be created',' - Full path: '.PATH_site.$relpath.' - '.$general_message.' - - This error should not occur as '.$relpath.' must always be accessible in the root of a TYPO3 website. - ',3); + if (!@is_dir(PATH_site.$relpath)) { + if ($descr[1]) { // required... + $this->message($ext, $relpath.' directory does not exist and could not be created', ' +

+ Full path: ' . PATH_site . $relpath . ' +
+ ' . $general_message . ' +

+

+ This error should not occur as ' . $relpath . ' must + always be accessible in the root of a TYPO3 website. +

+ ', 3); } else { - if ($descr[1] == 0) { + if ($descr[1] == 0) { $msg = 'This directory does not necessarily have to exist but if it does it must be writable.'; } else { $msg = 'This directory does not necessarily have to exist and if it does it can be writable or not.'; } - $this->message($ext, $relpath.' directory does not exist',' - Full path: '.PATH_site.$relpath.' - '.$general_message.' - - '.$msg.' - ',2); + $this->message($ext, $relpath.' directory does not exist', ' +

+ Full path: ' . PATH_site . $relpath . ' +
+ ' . $general_message . ' +

+

+ ' . $msg . ' +

+ ', 2); } } else { $file = PATH_site.$relpath.$uniqueName; @touch($file); - if (@is_file($file)) { + if (@is_file($file)) { unlink($file); - if ($descr[2]) { $this->config_array[$descr[2]]=1; } + if ($descr[2]) { $this->config_array[$descr[2]]=1; } $this->message($ext, $relpath.' writable','',-1); } else { $severity = ($descr[1]==2 || $descr[1]==0) ? 3 : 2; @@ -1869,13 +2916,19 @@ } elseif ($descr[1] == -1 || $descr[1] == 1) { $msg = 'The directory '.$relpath.' does not neccesarily have to be writable.'; } - $this->message($ext, $relpath.' directory not writable',' - Full path: '.$file.' - '.$general_message.' - - Tried to write this file (with touch()) but didn\'t succeed. - '.$msg.' - ',$severity); + $this->message($ext, $relpath .' directory not writable', ' +

+ Full path: ' . $file . ' +
+ ' . $general_message . ' +

+

+ Tried to write this file (with touch()) but didn\'t + succeed. +
+ ' . $msg . ' +

+ ', $severity); } } } @@ -1886,36 +2939,41 @@ * * This tries to find available ImageMagick installations and tries to find the version numbers by executing "convert" without parameters. If the ->checkIMlzw is set, LZW capabilities of the IM installs are check also. * - * @param [type] $paths: ... - * @return [type] ... + * @param array $paths Possible ImageMagick paths + * @return void */ - function checkImageMagick($paths) { + function checkImageMagick($paths) { $ext='Check Image Magick'; $this->message($ext); + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'CheckImageMagick.html'); $paths = array_unique($paths); $programs = explode(',','gm,convert,combine,composite,identify'); $isExt = TYPO3_OS=="WIN" ? ".exe" : ""; $this->config_array['im_combine_filename']='combine'; - reset($paths); - while(list($k,$v)=each($paths)) { - reset($programs); + foreach ($paths as $k => $v) { if (!preg_match('/[\\/]$/',$v)) $v.='/'; - while(list(,$filename)=each($programs)) { + foreach ($programs as $filename) { if (ini_get('open_basedir') || (file_exists($v)&&@is_file($v.$filename.$isExt))) { $version = $this->_checkImageMagick_getVersion($filename,$v); - if($version > 0) { - if($filename=='gm') { // Assume GraphicsMagick + if($version > 0) { + // Assume GraphicsMagick + if($filename=='gm') { $index[$v]['gm']=$version; - continue; // No need to check for "identify" etc. - } else { // Assume ImageMagick + // No need to check for "identify" etc. + continue; + } else { + // Assume ImageMagick $index[$v][$filename]=$version; } } } } - if (count($index[$v])>=3 || $index[$v]['gm']) { $this->config_array['im']=1; } + if (count($index[$v])>=3 || $index[$v]['gm']) { + $this->config_array['im'] = 1; + } if ($index[$v]['gm'] || (!$index[$v]['composite'] && $index[$v]['combine'])) { $this->config_array['im_combine_filename']='combine'; @@ -1923,59 +2981,97 @@ $this->config_array['im_combine_filename']='composite'; } - if (isset($index[$v]['convert']) && $this->checkIMlzw) { + if (isset($index[$v]['convert']) && $this->checkIMlzw) { $index[$v]['gif_capability'] = ''.$this->_checkImageMagickGifCapability($v); } } $this->config_array['im_versions']=$index; - if (!$this->config_array['im']) { - $this->message($ext, 'No ImageMagick installation available'," - It seems that there is no adequate ImageMagick installation available at the checked locations (".implode($paths, ', ').") - An 'adequate' installation for requires 'convert', 'combine'/'composite' and 'identify' to be available - ",2); + if (!$this->config_array['im']) { + $this->message($ext, 'No ImageMagick installation available', ' +

+ It seems that there is no adequate ImageMagick installation + available at the checked locations (' . implode(', ', $paths) . ') +
+ An \'adequate\' installation for requires \'convert\', + \'combine\'/\'composite\' and \'identify\' to be available +

+ ', 2); } else { - $theCode=''; - reset($this->config_array['im_versions']); - while(list($p,$v)=each($this->config_array['im_versions'])) { - $ka=array(); + // Get the subpart for the ImageMagick versions + $theCode = $this->contentObject->getSubpart($templateFile, '###VERSIONS###'); + // Get the subpart for each ImageMagick version + $rowsSubPart = $this->contentObject->getSubpart($theCode, '###ROWS###'); + + foreach ($this->config_array['im_versions'] as $p => $v) { + $ka = array(); reset($v); - while(list($ka[])=each($v)){} - $theCode.=''.$this->fw($p).''.$this->fw(implode($ka,'
')).''.$this->fw(implode($v,'
')).''; + while(list($ka[])=each($v)) {} + // Define the markers content + $rowsMarkers = array( + 'file' => $p, + 'type' => implode('
', $ka), + 'version' => implode('
', $v) + ); + // Fill the markers in the subpart + $rows[] = $this->contentObject->substituteMarkerArray( + $rowsSubPart, + $rowsMarkers, + '###|###', + 1, + 1 + ); } - $this->message($ext, 'Available ImageMagick/GraphicsMagick installations:',''.$theCode.'
',-1); + // Substitute the subpart for the ImageMagick versions + $theCode = $this->contentObject->substituteSubpart( + $theCode, + '###ROWS###', + implode(chr(10), $rows) + ); + // Add the content to the message array + $this->message($ext, 'Available ImageMagick/GraphicsMagick installations:', $theCode, -1); } - $this->message($ext, 'Search for ImageMagick:',' -
- INSTALL['checkIM']['lzw']?' checked="checked"':'').'> - - Check this path for ImageMagick installation: - - (Eg. "D:\wwwroot\im537\ImageMagick\" for Windows or "/usr/bin/" for Unix)
- - -
- ',0); - + // Get the template file + $formSubPart = $this->contentObject->getSubpart($templateFile, '###FORM###'); + // Define the markers content + $formMarkers = array( + 'actionUrl' => $this->action, + 'lzwChecked' => ($this->INSTALL['checkIM']['lzw'] ? 'checked="checked"' : ''), + 'lzwLabel' => 'Check LZW capabilities.', + 'checkPath' => 'Check this path for ImageMagick installation:', + 'imageMagickPath' => htmlspecialchars($this->INSTALL['checkIM']['path']), + 'comment' => '(Eg. "D:\wwwroot\im537\ImageMagick\" for Windows or "/usr/bin/" for Unix)', + 'send' => 'Send' + ); + // Fill the markers + $formSubPart = $this->contentObject->substituteMarkerArray( + $formSubPart, + $formMarkers, + '###|###', + 1, + 1 + ); + // Add the content to the message array + $this->message($ext, 'Search for ImageMagick:', $formSubPart, 0); } /** * Checking GIF-compression capabilities of ImageMagick install * - * @param [type] $file: ... - * @return [type] ... + * @param string $path Path of ImageMagick installation + * @return string Type of compression */ - function _checkImageMagickGifCapability($path) { - if ($this->config_array['dir_typo3temp']) { // && !$this->config_array['safemode'] + function _checkImageMagickGifCapability($path) { + if ($this->config_array['dir_typo3temp']) { // && !$this->config_array['safemode'] $tempPath = $this->typo3temp_path; $uniqueName = md5(uniqid(microtime())); $dest = $tempPath.$uniqueName.'.gif'; $src = $this->backPath.'gfx/typo3logo.gif'; - if (@is_file($src) && !strstr($src,' ') && !strstr($dest,' ')) { + if (@is_file($src) && !strstr($src,' ') && !strstr($dest,' ')) { $cmd = t3lib_div::imageMagickCommand('convert', $src.' '.$dest, $path); exec($cmd); } else die('No typo3/gfx/typo3logo.gif file!'); $out=''; - if (@is_file($dest)) { + if (@is_file($dest)) { $new_info = @getimagesize($dest); clearstatcache(); $new_size = filesize($dest); @@ -1983,12 +3079,14 @@ clearstatcache(); $src_size = @filesize($src); - if ($new_info[0]!=$src_info[0] || $new_info[1]!=$src_info[1] || !$new_size || !$src_size) { + if ($new_info[0]!=$src_info[0] || $new_info[1]!=$src_info[1] || !$new_size || !$src_size) { $out='error'; } else { - if ($new_size/$src_size > 4) { // NONE-LZW ratio was 5.5 in test + // NONE-LZW ratio was 5.5 in test + if ($new_size/$src_size > 4) { $out='NONE'; - } elseif ($new_size/$src_size > 1.5) { // NONE-RLE ratio was not tested + // NONE-RLE ratio was not tested + } elseif ($new_size/$src_size > 1.5) { $out='RLE'; } else { $out='LZW'; @@ -2003,23 +3101,26 @@ /** * Extracts the version number for ImageMagick * - * @param string The program name to execute in order to find out the version number - * @param string Path for the above program - * @return string Version number of the found ImageMagick instance + * @param string $file The program name to execute in order to find out the version number + * @param string $path Path for the above program + * @return string Version number of the found ImageMagick instance */ - function _checkImageMagick_getVersion($file, $path) { + function _checkImageMagick_getVersion($file, $path) { // Temporarily override some settings $im_version = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']; $combine_filename = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename']; - if ($file=='gm') { + if ($file=='gm') { $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] = 'gm'; - $file = 'identify'; // Work-around, preventing execution of "gm gm" - $parameters = '-version'; // Work-around - GM doesn't like to be executed without any arguments + // Work-around, preventing execution of "gm gm" + $file = 'identify'; + // Work-around - GM doesn't like to be executed without any arguments + $parameters = '-version'; } else { $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] = 'im5'; - if($file=='combine' || $file=='composite') { // Override the combine_filename setting + // Override the combine_filename setting + if ($file=='combine' || $file=='composite') { $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename'] = $file; } } @@ -2040,59 +3141,101 @@ /** * Checks database username/password/host/database * - * @return [type] ... + * @return void */ - function checkDatabase() { + function checkDatabase() { $ext='Check database'; $this->message($ext); - if (!extension_loaded('mysql') && !t3lib_extMgm::isLoaded('dbal')) { - $this->message($ext, 'MySQL not available'," - PHP does not feature MySQL support (which is pretty unusual). - ",2); + if (!extension_loaded('mysql') && !t3lib_extMgm::isLoaded('dbal')) { + $this->message($ext, 'MySQL not available', ' +

+ PHP does not feature MySQL support (which is pretty unusual). +

+ ', 2); } else { - $cInfo=' - Username: '.TYPO3_db_username.' - Host: '.TYPO3_db_host.' - '; - if (!TYPO3_db_host || !TYPO3_db_username) { - $this->message($ext, 'Username, password or host not set'," - You may need to enter data for these values: - ".trim($cInfo)." - - Use the form below. - ",2); + if (!TYPO3_db_host || !TYPO3_db_username) { + $this->message($ext, 'Username, password or host not set', ' +

+ You may need to enter data for these values: +
+ Username: ' . TYPO3_db_username . ' +
+ Host: ' . TYPO3_db_host . ' +
+
+ Use the form below. +

+ ', 2); } - if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { - $this->message($ext, 'Connected to SQL database successfully'," - ".trim($cInfo)." - ",-1,1); + if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { + $this->message($ext, 'Connected to SQL database successfully', ' +
+
+ Username: +
+
+ ' . TYPO3_db_username . ' +
+
+ Host: +
+
+ ' . TYPO3_db_host . ' +
+
+ ', -1, 1); $this->config_array['mysqlConnect']=1; - if (!TYPO3_db) { - $this->message($ext, 'No database selected'," - Currently you have no database selected. - Please select one or create a new database. - ",3); + if (!TYPO3_db) { + $this->message($ext, 'No database selected', ' +

+ Currently you have no database selected. +
+ Please select one or create a new database. +

+ ', 3); $this->config_array['no_database']=1; } elseif (!$GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) { - $this->message($ext, 'Database'," - '".TYPO3_db."' could not be selected as database! - Please select another one or create a new database. - ",3,1); + $this->message($ext, 'Database', ' +

+ \''.TYPO3_db.'\' could not be selected as database! +
+ Please select another one or create a new database. +

+ ', 3, 1); $this->config_array['no_database']=1; } else { - $this->message($ext, 'Database'," - ".TYPO3_db." is selected as database. - ",1,1); + $this->message($ext, 'Database', ' +

+ ' . TYPO3_db . ' is selected as + database. +

+ ', 1, 1); } } else { - $this->message($ext, 'Could not connect to SQL database!'," - Connecting to SQL database failed with these settings: - ".trim($cInfo)." + $sqlSafeModeUser = ''; - Make sure you're using the correct set of data.".($this->config_array['sql.safe_mode_user']? " - Notice: sql.safe_mode is turned on, so apparently your username to the database is the same as the scriptowner, which is '".$this->config_array['sql.safe_mode_user']."'":"")." - ",3); + if ($this->config_array['sql.safe_mode_user']) { + $sqlSafeModeUser = ' + Notice: + sql.safe_mode is turned on, so apparently your + username to the database is the same as the scriptowner, + which is ' . $this->config_array['sql.safe_mode_user']; + } + $this->message($ext, 'Could not connect to SQL database!', ' +

+ Connecting to SQL database failed with these settings: +
+ Username: ' . TYPO3_db_username . ' +
+ Host: ' . TYPO3_db_host . ' +

+

+ Make sure you\'re using the correct set of data. +
+ ' . $sqlSafeModeUser . ' +

+ ', 3); } } } @@ -2100,128 +3243,565 @@ /** * Prints form for updating localconf.php or updates localconf.php depending on $cmd * - * @param string $cmd If "get_form" it outputs the form. Default is to write "localconf.php" based on input in ->INSTALL[localconf.php] array and flag ->setLocalconf - * @return [type] ... + * @param string $cmd If "get_form" it outputs the form. Default is to write "localconf.php" based on input in ->INSTALL[localconf.php] array and flag ->setLocalconf + * @return string Form HTML */ - function setupGeneral($cmd='') { - switch($cmd) { + function setupGeneral($cmd='') { + switch($cmd) { case 'get_form': - // Database: - $out=' -
- '; + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'SetupGeneral.html'); + // Get the template part from the file + $form = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Get the subpart for all modes + $allModesSubpart = $this->contentObject->getSubpart($form, '###ALLMODES###'); + // Define the markers content + $formMarkers['actionUrl'] = $this->action; - $out.=$this->wrapInCells('Username:', ''.($this->config_array['sql.safe_mode_user']?"
sql.safe_mode_user: ".$this->config_array['sql.safe_mode_user']."":"")); - $out.=$this->wrapInCells('Password:', ''); - $out.=$this->wrapInCells('Host:', ''); - if ($this->config_array['mysqlConnect']) { + // Username + if (TYPO3_db_username) { + $username = TYPO3_db_username; + } elseif ($this->config_array['sql.safe_mode_user']) { + $username = $this->config_array['sql.safe_mode_user']; + // Get the subpart for the sql safe mode user + $sqlSafeModeUserSubpart = $this->contentObject->getSubpart($allModesSubpart, '###SQLSAFEMODEUSERSUBPART###'); + // Define the markers content + $sqlSafeModeUserMarkers = array( + 'labelSqlSafeModeUser' => 'sql.safe_mode_user:', + 'sqlSafeModeUser' => $this->config_array['sql.safe_mode_user'] + ); + // Fill the markers in the subpart + $sqlSafeModeUserSubpart = $this->contentObject->substituteMarkerArray( + $sqlSafeModeUserSubpart, + $sqlSafeModeUserMarkers, + '###|###', + 1, + 1 + ); + } + // Get the subpart for all modes + $allModesSubpart = $this->contentObject->substituteSubpart( + $allModesSubpart, + '###SQLSAFEMODEUSERSUBPART###', + $sqlSafeModeUserSubpart + ); + // Define the markers content + $allModesMarkers = array( + 'labelUsername' => 'Username:', + 'username' => htmlspecialchars($username), + 'labelPassword' => 'Password:', + 'password' => htmlspecialchars(TYPO3_db_password), + 'labelHost' => 'Host:', + 'host' => htmlspecialchars(TYPO3_db_host), + 'labelDatabase' => 'Database:', + 'labelCreateDatabase' => 'Create database?' + ); + // Get the subpart for the database list + $databasesSubpart = $this->contentObject->getSubpart($allModesSubpart, '###DATABASELIST###'); + if ($this->config_array['mysqlConnect']) { + // Get the subpart when database is available + $databaseAvailableSubpart = $this->contentObject->getSubpart($databasesSubpart, '###DATABASEAVAILABLE###'); + // Get the subpart for each database table + $databaseItemSubpart = $this->contentObject->getSubpart($databaseAvailableSubpart, '###DATABASEITEM###'); $dbArr = $this->getDatabaseList(); - reset($dbArr); $options=''; $dbIncluded=0; - while(list(,$dbname)=each($dbArr)) { - $options.=''; + foreach ($dbArr as $dbname) { + // Define the markers content + $databaseItemMarkers = array( + 'databaseSelected' => '', + 'databaseName' => htmlspecialchars($dbname), + 'databaseValue' => htmlspecialchars($dbname) + ); + if ($dbname == TYPO3_db) { + $databaseItemMarkers['databaseSelected'] = 'selected="selected"'; + } + // Fill the markers in the subpart + $databaseItems[] = $this->contentObject->substituteMarkerArray( + $databaseItemSubpart, + $databaseItemMarkers, + '###|###', + 1, + 0 + ); if ($dbname==TYPO3_db) $dbIncluded=1; } - if (!$dbIncluded && TYPO3_db) { - $options.=''; + if (!$dbIncluded && TYPO3_db) { + $databaseItemMarkers['databaseName'] = htmlspecialchars(TYPO3_db); + $databaseItemMarkers['databaseSelected'] = 'selected="selected"'; + $databaseItemMarkers['databaseValue'] = htmlspecialchars(TYPO3_db) . ' (NO ACCESS!)'; + // Fill the markers in the subpart + $databaseItems[] = $this->contentObject->substituteMarkerArray( + $databaseItemSubpart, + $databaseItemMarkers, + '###|###', + 1, + 0 + ); } - $theCode='
Create database? (Enter name):
'; + // Substitute the subpart for the database tables + $databaseAvailableSubpart = $this->contentObject->substituteSubpart( + $databaseAvailableSubpart, + '###DATABASEITEM###', + implode(chr(10), $databaseItems) + ); } else { - $theCode=''.htmlspecialchars(TYPO3_db).'
(Can only select database if username/password/host is correctly set first)'; + // Get the subpart when the database is not available + $databaseNotAvailableSubpart = $this->contentObject->getSubpart($databasesSubpart, '###DATABASENOTAVAILABLE###'); + $databaseNotAvailableMarkers = array( + 'typo3Db' => htmlspecialchars(TYPO3_db), + 'labelNoDatabase' => ' + (Can only select database if username/password/host + is correctly set first) + ' + ); + // Fill the markers in the subpart + $databaseNotAvailableSubpart = $this->contentObject->substituteMarkerArray( + $databaseNotAvailableSubpart, + $databaseNotAvailableMarkers, + '###|###', + 1, + 0 + ); } - $out.=$this->wrapInCells('', '
'); - $out.=$this->wrapInCells('Database:', $theCode); - $out.=$this->wrapInCells('', '
'); + // Substitute the subpart when database is available + $databasesSubpart = $this->contentObject->substituteSubpart( + $databasesSubpart, + '###DATABASEAVAILABLE###', + $databaseAvailableSubpart + ); + // Substitute the subpart when database is not available + $databasesSubpart = $this->contentObject->substituteSubpart( + $databasesSubpart, + '###DATABASENOTAVAILABLE###', + $databaseNotAvailableSubpart + ); + // Substitute the subpart for the databases + $allModesSubpart = $this->contentObject->substituteSubpart( + $allModesSubpart, + '###DATABASELIST###', + $databasesSubpart + ); + // Fill the markers in the subpart for all modes + $allModesSubpart = $this->contentObject->substituteMarkerArray( + $allModesSubpart, + $allModesMarkers, + '###|###', + 1, + 1 + ); + // Substitute the subpart for all modes + $form = $this->contentObject->substituteSubpart( + $form, + '###ALLMODES###', + $allModesSubpart + ); - if ($this->mode!='123') { - $this->headerStyle .= chr(10) . - ' - '; + if ($this->mode!='123') { + $this->javascript[] = ''; + $this->javascript[] = ''; + // Get the subpart for the regular mode + $regularModeSubpart = $this->contentObject->getSubpart($form, '###REGULARMODE###'); + // Define the markers content + $regularModeMarkers = array( + 'labelSiteName' => 'Site name:', + 'siteName' => htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']), + 'labelEncryptionKey' => 'Encryption key:', + 'encryptionKey' => htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']), + 'labelGenerateRandomKey' => 'Generate random key' + ); - - $out.=$this->wrapInCells('Site name:', ''); - $out.=$this->wrapInCells('', '
'); - $out.=$this->wrapInCells('Encryption key:', '
'); - $out.=$this->wrapInCells('', '
'); - // Other $fA = $this->setupGeneralCalculate(); + $regularModeMarkers['labelCurrentValueIs'] = 'current value is'; - if (is_array($fA['disable_exec_function'])) { - $out.=$this->wrapInCells('[BE][disable_exec_function]=', $this->getFormElement($fA['disable_exec_function'], $fA['disable_exec_function'], 'TYPO3_INSTALL[localconf.php][disable_exec_function]', $GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function'])); + // Disable exec function + if (is_array($fA['disable_exec_function'])) { + // Get the subpart for the disable exec function + $disableExecFunctionSubpart = $this->contentObject->getSubpart($regularModeSubpart, '###DISABLEEXECFUNCTIONSUBPART###'); + $regularModeMarkers['labelDisableExecFunction'] = '[BE][disable_exec_function]='; + $regularModeMarkers['strongDisableExecFunction'] = (integer) current($fA['disable_exec_function']); + $regularModeMarkers['defaultDisableExecFunction'] = (integer) $GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function']; + $regularModeMarkers['disableExecFunction'] = (integer) current($fA['disable_exec_function']); + // Fill the markers in the subpart + $disableExecFunctionSubpart = $this->contentObject->substituteMarkerArray( + $disableExecFunctionSubpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); } - if (is_array($fA['gdlib'])) { - $out.=$this->wrapInCells('[GFX][gdlib]=', $this->getFormElement($fA['gdlib'], $fA['gdlib'], 'TYPO3_INSTALL[localconf.php][gdlib]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'])); - if (is_array($fA['gdlib_png']) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) { - $out.=$this->wrapInCells('[GFX][gdlib_png]=', $this->getFormElement($this->setLabelValueArray($fA['gdlib_png'],2), $fA['gdlib_png'], 'TYPO3_INSTALL[localconf.php][gdlib_png]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png'])); + // Substitute the subpart for the disable exec function + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###DISABLEEXECFUNCTIONSUBPART###', + $disableExecFunctionSubpart + ); + + // GDlib + if (is_array($fA['gdlib'])) { + // Get the subpart for the disable gd lib + $gdLibSubpart = $this->contentObject->getSubpart($regularModeSubpart, '###DISABLEGDLIB###'); + $regularModeMarkers['labelGdLib'] = '[GFX][gdlib]='; + $regularModeMarkers['strongGdLib'] = (integer) current($fA['gdlib']); + $regularModeMarkers['defaultGdLib'] = (integer) $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']; + $regularModeMarkers['gdLib'] = (integer) current($fA['gdlib']); + // Fill the markers in the subpart + $gdLibSubpart = $this->contentObject->substituteMarkerArray( + $gdLibSubpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for the disable gdlib + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###DISABLEGDLIB###', + $gdLibSubpart + ); + + // GDlib PNG + if (is_array($fA['gdlib_png']) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) { + // Get the subpart for the gdlib png + $gdLibPngSubpart = $this->contentObject->getSubpart($regularModeSubpart, '###GDLIBPNGSUBPART###'); + // Get the subpart for the dropdown options + $gdLibPngOptionSubpart = $this->contentObject->getSubpart($gdLibPngSubpart, '###GDLIBPNGOPTION###'); + $gdLibPngLabels = $this->setLabelValueArray($fA['gdlib_png'], 2); + reset($gdLibPngLabels); + + $regularModeMarkers['labelGdLibPng'] = '[GFX][gdlib_png]='; + $regularModeMarkers['strongGdLibPng'] = (string) current($gdLibPngLabels); + $regularModeMarkers['defaultGdLibPng'] = (integer) $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png']; + + foreach ($gdLibPngLabels as $k => $v) { + list($cleanV) = explode('|', $fA['gdlib_png'][$k]); + $gdLibPngMarker['value'] = htmlspecialchars($fA['gdlib_png'][$k]); + $gdLibPngMarker['data'] = htmlspecialchars($v); + if (!strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png'], $cleanV)) { + $gdLibPngMarker['selected'] = 'selected="selected"'; + } + // Fill the markers in the subpart + $gdLibPngOptions[] = $this->contentObject->substituteMarkerArray( + $gdLibPngOptionSubpart, + $gdLibPngMarker, + '###|###', + 1, + 1 + ); } + // Substitute the subpart for the dropdown options + $gdLibPngSubpart = $this->contentObject->substituteSubpart( + $gdLibPngSubpart, + '###GDLIBPNGOPTION###', + implode(chr(10), $gdLibPngOptions) + ); + // Fill the markers in the subpart + $gdLibPngSubpart = $this->contentObject->substituteMarkerArray( + $gdLibPngSubpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); } - if (is_array($fA['im'])) { - $out.=$this->wrapInCells('[GFX][im]=', $this->getFormElement($fA['im'], $fA['im'], 'TYPO3_INSTALL[localconf.php][im]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im'])); - $out.=$this->wrapInCells('[GFX][im_combine_filename]=', $this->getFormElement($fA['im_combine_filename'], ($fA['im_combine_filename']?$fA['im_combine_filename']:"combine"), 'TYPO3_INSTALL[localconf.php][im_combine_filename]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename'])); - $out.=$this->wrapInCells('[GFX][im_version_5]=', $this->getFormElement($fA['im_version_5'], ($fA['im_version_5']?$fA['im_version_5']:''), 'TYPO3_INSTALL[localconf.php][im_version_5]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'])); - if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im']) { - if (is_array($fA['im_path'])) { - $out.=$this->wrapInCells('[GFX][im_path]=', $this->getFormElement($this->setLabelValueArray($fA['im_path'],1), $this->setLabelValueArray($fA['im_path'],0), 'TYPO3_INSTALL[localconf.php][im_path]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'])); + // Substitute the subpart for the gdlib png + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###GDLIBPNGSUBPART###', + $gdLibPngSubpart + ); + + // ImageMagick + if (is_array($fA['im'])) { + // Get the subpart for ImageMagick + $imageMagickSubpart = $this->contentObject->getSubpart($regularModeSubpart, '###IMAGEMAGICKSUBPART###'); + // Define the markers content + $regularModeMarkers['labelImageMagick'] = '[GFX][im]='; + $regularModeMarkers['strongImageMagick'] = (string) current($fA['im']); + $regularModeMarkers['defaultImageMagick'] = (integer) $GLOBALS['TYPO3_CONF_VARS']['GFX']['im']; + $regularModeMarkers['imageMagick'] = (integer) current($fA['im']); + // Fill the markers in the subpart + $imageMagickSubpart = $this->contentObject->substituteMarkerArray( + $imageMagickSubpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); + + // IM Combine Filename + // Get the subpart for ImageMagick Combine filename + $imCombineFileNameSubpart = $this->contentObject->getSubpart($regularModeSubpart, '###IMCOMBINEFILENAMESUBPART###'); + // Define the markers content + $regularModeMarkers['labelImCombineFilename'] = '[GFX][im_combine_filename]'; + $regularModeMarkers['strongImCombineFilename'] = (string) current($fA['im_combine_filename']); + $regularModeMarkers['defaultImCombineFilename'] = (string) $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename']; + $regularModeMarkers['imCombineFilename'] = (string) ($fA['im_combine_filename'] ? current($fA['im_combine_filename']) : 'combine'); + // Fill the markers in the subpart + $imCombineFileNameSubpart = $this->contentObject->substituteMarkerArray( + $imCombineFileNameSubpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); + + // IM Version 5 + // Get the subpart for ImageMagick Version 5 + $imVersion5Subpart = $this->contentObject->getSubpart($regularModeSubpart, '###IMVERSION5SUBPART###'); + // Define the markers content + $regularModeMarkers['labelImVersion5'] = '[GFX][im_version_5]='; + $regularModeMarkers['strongImVersion5'] = (string) current($fA['im_version_5']); + $regularModeMarkers['defaultImVersion5'] = (string) $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']; + $regularModeMarkers['imVersion5'] = (string) ($fA['im_version_5'] ? current($fA['im_version_5']) : ''); + // Fill the markers in the subpart + $imVersion5Subpart = $this->contentObject->substituteMarkerArray( + $imVersion5Subpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); + + if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im']) { + // IM Path + if (is_array($fA['im_path'])) { + // Get the subpart for ImageMagick path + $imPathSubpart = $this->contentObject->getSubpart($regularModeSubpart, '###IMPATHSUBPART###'); + + $labelImPath = $this->setLabelValueArray($fA['im_path'], 1); + reset($labelImPath); + $imPath = $this->setLabelValueArray($fA['im_path'], 0); + reset($imPath); + // Define the markers content + $regularModeMarkers['labelImPath'] = '[GFX][im_path]='; + $regularModeMarkers['strongImPath'] = (string) current($labelImPath); + $regularModeMarkers['defaultImPath'] = (string) $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path']; + $regularModeMarkers['ImPath'] = (string) current($imPath); + // Fill the markers in the subpart + $imPathSubpart = $this->contentObject->substituteMarkerArray( + $imPathSubpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); } - if (is_array($fA['im_path_lzw'])) { - $out.=$this->wrapInCells('[GFX][im_path_lzw]=', $this->getFormElement($this->setLabelValueArray($fA['im_path_lzw'],1), $this->setLabelValueArray($fA['im_path_lzw'],0), 'TYPO3_INSTALL[localconf.php][im_path_lzw]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'])); + // IM Path LZW + if (is_array($fA['im_path_lzw'])) { + // Get the subpart for ImageMagick lzw path + $imPathLzwSubpart = $this->contentObject->getSubpart($regularModeSubpart, '###IMPATHLZWSUBPART###'); + // Get the subpart for ImageMagick lzw path dropdown options + $imPathOptionSubpart = $this->contentObject->getSubpart($regularModeSubpart, '###IMPATHLZWOPTION###'); + + $labelImPathLzw = $this->setLabelValueArray($fA['im_path_lzw'], 1); + reset($labelImPathLzw); + $imPathLzw = $this->setLabelValueArray($fA['im_path_lzw'], 0); + reset($imPathLzw); + // Define the markers content + $regularModeMarkers['labelImPathLzw'] = '[GFX][im_path_lzw]='; + $regularModeMarkers['strongImPathLzw'] = (string) current($labelImPathLzw); + $regularModeMarkers['defaultImPathLzw'] = (string) $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw']; + $regularModeMarkers['ImPathLzw'] = (string) current($imPathLzw); + + foreach ($labelImPathLzw as $k => $v) { + list($cleanV) = explode('|', $fA['im_path_lzw'][$k]); + // Define the markers content + $imPathLzwMarker = array( + 'value' => htmlspecialchars($fA['im_path_lzw'][$k]), + 'data' => htmlspecialchars($v) + ); + if (!strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'], $cleanV)) { + $imPathLzwMarker['selected'] = 'selected="selected"'; + } + // Fill the markers in the subpart + $imPathLzwOptions[] = $this->contentObject->substituteMarkerArray( + $imPathOptionSubpart, + $imPathLzwMarker, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for ImageMagick lzw path dropdown options + $imPathLzwSubpart = $this->contentObject->substituteSubpart( + $imPathLzwSubpart, + '###IMPATHLZWOPTION###', + implode(chr(10), $imPathLzwOptions) + ); + // Fill the markers in the subpart + $imPathLzwSubpart = $this->contentObject->substituteMarkerArray( + $imPathLzwSubpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); } } } - $out.=$this->wrapInCells('[GFX][TTFdpi]=', ''); + // Substitute the subpart for ImageMagick + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###IMAGEMAGICKSUBPART###', + $imageMagickSubpart + ); + // Substitute the subpart for ImageMagick Combine filename + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###IMCOMBINEFILENAMESUBPART###', + $imCombineFileNameSubpart + ); + // Substitute the subpart for ImageMagick Version 5 + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###IMVERSION5SUBPART###', + $imVersion5Subpart + ); + // Substitute the subpart for ImageMagick path + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###IMPATHSUBPART###', + $imPathSubpart + ); + // Substitute the subpart for ImageMagick lzw path + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###IMPATHLZWSUBPART###', + $imPathLzwSubpart + ); + + // TrueType Font dpi + // Get the subpart for TrueType dpi + $ttfDpiSubpart = $this->contentObject->getSubpart($regularModeSubpart, '###TTFDPISUBPART###'); + // Define the markers content + $regularModeMarkers['labelTtfDpi'] = '[GFX][TTFdpi]='; + $regularModeMarkers['ttfDpi'] = htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['GFX']['TTFdpi']); + // Fill the markers in the subpart + $ttfDpiSubpart = $this->contentObject->substituteMarkerArray( + $ttfDpiSubpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); + // Substitute the subpart for TrueType dpi + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###TTFDPISUBPART###', + $ttfDpiSubpart + ); + // Fill the markers in the regular mode subpart + $regularModeSubpart = $this->contentObject->substituteMarkerArray( + $regularModeSubpart, + $regularModeMarkers, + '###|###', + 1, + 1 + ); } - - $out.=$this->wrapInCells('', '

- NOTICE: By clicking this button, localconf.php is updated with new values for the parameters listed above!'); - $out.=' -
-
'; + $formMarkers['labelUpdateLocalConf'] = 'Update localconf.php'; + $formMarkers['labelNotice'] = 'NOTICE:'; + $formMarkers['labelCommentUpdateLocalConf'] = 'By clicking this button, localconf.php is updated with new values for the parameters listed above!'; + // Substitute the subpart for regular mode + $form = $this->contentObject->substituteSubpart( + $form, + '###REGULARMODE###', + $regularModeSubpart + ); + // Fill the markers + $out = $this->contentObject->substituteMarkerArray( + $form, + $formMarkers, + '###|###', + 1, + 1 + ); break; default: - if (is_array($this->INSTALL['localconf.php'])) { - $errorMessages=array(); + if (is_array($this->INSTALL['localconf.php'])) { $lines = $this->writeToLocalconf_control(); // New database? -#debug($this->INSTALL); - if (trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME'])) { + if (trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME'])) { $newdbname=trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME']); - if (!preg_match('/[^[:alnum:]_-]/',$newdbname)) { - if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { + if (!preg_match('/[^[:alnum:]_-]/',$newdbname)) { + if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { if ($GLOBALS['TYPO3_DB']->admin_query('CREATE DATABASE '.$newdbname)) { $this->INSTALL['localconf.php']['typo_db'] = $newdbname; $this->messages[]= "Database '".$newdbname."' created"; - } else $this->messages[]= $errorMessages[] = "Could not create database '".$newdbname."' (...not created)"; - } else $this->messages[]= $errorMessages[] = "Could not connect to database when creating database '".$newdbname."' (...not created)"; - } else $this->messages[]= $errorMessages[] = "The NEW database name '".$newdbname."' was not alphanumeric, a-zA-Z0-9_- (...not created)"; + } else { + $this->errorMessages[] = ' + Could not create database \'' . + $newdbname . '\' (...not created) + '; + } + } else { + $this->errorMessages[] = ' + Could not connect to database when creating + database \'' . $newdbname . '\' (...not + created) + '; + } + } else { + $this->errorMessages[] = ' + The NEW database name \'' . $newdbname . '\' was + not alphanumeric, a-zA-Z0-9_- (...not created) + '; + } } -#debug($this->messages) ; // Parsing values - reset($this->INSTALL['localconf.php']); - while(list($key,$value)=each($this->INSTALL['localconf.php'])) { - switch((string)$key) { + foreach ($this->INSTALL['localconf.php'] as $key => $value) { + switch((string)$key) { case 'typo_db_username': - if (strlen($value)<50) { + if (strlen($value)<50) { if (strcmp(TYPO3_db_username,$value)) $this->setValueInLocalconfFile($lines, '$typo_db_username', trim($value)); - } else $this->messages[]= $errorMessages[] = "Username '".$value."' was longer than 50 chars (...not saved)"; + } else { + $this->errorMessages[] = ' + Username \'' . $value . '\' was longer + than 50 chars (...not saved) + '; + } break; case 'typo_db_password': - if (strlen($value)<50) { + if (strlen($value)<50) { if (strcmp(TYPO3_db_password,$value)) $this->setValueInLocalconfFile($lines, '$typo_db_password', trim($value)); - } else $this->messages[]= $errorMessages[] = "Password was longer than 50 chars (...not saved)"; + } else { + $this->errorMessages[] = ' + Password was longer than 50 chars (...not saved) + '; + } break; case 'typo_db_host': - if (preg_match('/^[a-zA-Z0-9_\.-]+(:.+)?$/',$value) && strlen($value)<50) { + if (preg_match('/^[a-zA-Z0-9_\.-]+(:.+)?$/',$value) && strlen($value)<50) { if (strcmp(TYPO3_db_host,$value)) $this->setValueInLocalconfFile($lines, '$typo_db_host', $value); - } else $this->messages[]= $errorMessages[] = "Host '".$value."' was not alphanumeric (a-z, A-Z, 0-9 or _-.), or longer than 50 chars (...not saved)"; + } else { + $this->errorMessages[] = ' + Host \'' . $value . '\' was not + alphanumeric (a-z, A-Z, 0-9 or _-.), or + longer than 50 chars (...not saved) + '; + } break; case 'typo_db': - if (strlen($value)<50) { + if (strlen($value)<50) { if (strcmp(TYPO3_db,$value)) $this->setValueInLocalconfFile($lines, '$typo_db', trim($value)); - } else $this->messages[]= $errorMessages[] = "Database name '".$value."' was longer than 50 chars (...not saved)"; + } else { + $this->errorMessages[] = ' + Database name \'' . $value . '\' was + longer than 50 chars (...not saved) + '; + } break; case 'disable_exec_function': if (strcmp($GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function'],$value)) $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'BE\'][\'disable_exec_function\']', $value?1:0); @@ -2247,32 +3827,44 @@ break; case 'im_path': list($value,$version) = explode('|',$value); - if (!preg_match('/[[:space:]]/',$value,$reg) && strlen($value)<100) { + if (!preg_match('/[[:space:]]/',$value,$reg) && strlen($value)<100) { if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX'][$key], $value)) { $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'' . $key . '\']', $value); } - if(doubleval($version)>0 && doubleval($version)<4) { // Assume GraphicsMagick + if(doubleval($version)>0 && doubleval($version)<4) { // Assume GraphicsMagick $value_ext = 'gm'; - } elseif(doubleval($version)<5) { // Assume ImageMagick 4.x + } elseif(doubleval($version)<5) { // Assume ImageMagick 4.x $value_ext = ''; } elseif(doubleval($version) >= 6) { // Assume ImageMagick 6.x $value_ext = 'im6'; } else { // Assume ImageMagick 5.x $value_ext = 'im5'; } - if (strcmp(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']),$value_ext)) { + if (strcmp(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']),$value_ext)) { $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'im_version_5\']', $value_ext); } // if (strcmp(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']),$value)) $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS['GFX']['im_version_5']', $value); - } else $this->messages[]= $errorMessages[] = "Path '".$value."' contains spaces or is longer than 100 chars (...not saved)"; + } else { + $this->errorMessages[] = ' + Path \'' . $value . '\' contains spaces + or is longer than 100 chars (...not + saved) + '; + } break; case 'im_path_lzw': list($value) = explode('|',$value); - if (!preg_match('/[[:space:]]/',$value) && strlen($value)<100) { + if (!preg_match('/[[:space:]]/',$value) && strlen($value)<100) { if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX'][$key], $value)) { $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'' . $key . '\']', $value); } - } else $this->messages[]= $errorMessages[] = "Path '".$value."' contains spaces or is longer than 100 chars (...not saved)"; + } else { + $this->errorMessages[] = ' + Path \'' . $value . '\' contains spaces + or is longer than 100 chars (...not + saved) + '; + } break; case 'TTFdpi': if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX']['TTFdpi'],$value)) $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'TTFdpi\']', $value); @@ -2282,12 +3874,6 @@ } - if (count($errorMessages)) { - echo '

ERRORS

'; - echo t3lib_div::view_array($errorMessages); - echo 'Click the browsers "Back" button to reenter the values.'; - exit; - } $this->writeToLocalconf_control($lines); } break; @@ -2298,23 +3884,80 @@ /** * Writes or returns lines from localconf.php * - * @param array Array of lines to write back to localconf.php. Possibly - * @param boolean If TRUE then print what has been done. - * @return mixed If $lines is not an array it will return an array with the lines from localconf.php. Otherwise it will return a status string, either "continue" (updated) or "nochange" (not updated) + * @param array $lines Array of lines to write back to localconf.php. Possibly + * @param boolean $showOutput If TRUE then print what has been done. + * @return mixed If $lines is not an array it will return an array with the lines from localconf.php. Otherwise it will return a status string, either "continue" (updated) or "nochange" (not updated) * @see parent::writeToLocalconf_control() */ - function writeToLocalconf_control($lines='', $showOutput=TRUE) { + function writeToLocalconf_control($lines='', $showOutput=TRUE) { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'WriteToLocalConfControl.html'); + $returnVal = parent::writeToLocalconf_control($lines); - if ($showOutput) { - switch($returnVal) { + if ($showOutput) { + switch($returnVal) { case 'continue': - $content = '

'.implode($this->messages,'
').'

Click to continue...'; + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###CONTINUE###'); + // Get the subpart for messages + $messagesSubPart = $this->contentObject->getSubpart($template, '###MESSAGES###'); + + $messages = array(); + + foreach ($this->messages as $message) { + // Define the markers content + $messagesMarkers['message'] = $message; + // Fill the markers in the subpart + $messages[] = $this->contentObject->substituteMarkerArray( + $messagesSubPart, + $messagesMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for messages + $content = $this->contentObject->substituteSubpart( + $template, + '###MESSAGES###', + implode(chr(10), $messages) + ); + // Define the markers content + $markers = array( + 'header' => 'Writing to \'localconf.php\'', + 'action' => $this->action, + 'label' => 'Click to continue...' + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $content, + $markers, + '###|###', + 1, + 1 + ); $this->outputExitBasedOnStep($content); break; case 'nochange': - $content = 'Writing to \'localconf.php\':

No values were changed, so nothing is updated!

Click to continue...'; - $this->outputExitBasedOnStep('
'.$content); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###NOCHANGE###'); + // Define the markers content + $markers = array( + 'header' => 'Writing to \'localconf.php\'', + 'message' => 'No values were changed, so nothing is updated!', + 'action' => $this->action, + 'label' => 'Click to continue...' + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $template, + $markers, + '###|###', + 1, + 1 + ); + $this->outputExitBasedOnStep($content); break; } } @@ -2322,12 +3965,13 @@ } /** - * [Describe function...] + * If in 1-2-3 mode, send a redirect header response with the action and exit + * otherwise send output to output() function * - * @param [type] $content: ... - * @return [type] ... + * @param string $content The HTML to output + * @return void */ - function outputExitBasedOnStep($content) { + function outputExitBasedOnStep($content) { if ($this->step) { t3lib_utility_Http::redirect($this->action); } else { @@ -2339,25 +3983,26 @@ /** * This appends something to value in the input array based on $type. Private. * - * @param [type] $arr: ... - * @param [type] $type: ... - * @return [type] ... + * @param array $arr + * @param integer $type + * @return array */ - function setLabelValueArray($arr,$type) { - reset($arr); - while(list($k,$v)=each($arr)) { - if($this->config_array['im_versions'][$v]['gm']) { + function setLabelValueArray($arr,$type) { + foreach ($arr as $k => $v) { + if($this->config_array['im_versions'][$v]['gm']) { $program = 'gm'; } else { $program = 'convert'; } - switch($type) { - case 0: // value, im + switch($type) { + // value, im + case 0: $arr[$k].='|'.$this->config_array['im_versions'][$v][$program]; break; - case 1: // labels, im - if($this->config_array['im_versions'][$v][$program]) { + // labels, im + case 1: + if($this->config_array['im_versions'][$v][$program]) { $arr[$k].= ' ('.$this->config_array['im_versions'][$v][$program]; $arr[$k].= ($this->config_array['im_versions'][$v]['gif_capability'] ? ', '.$this->config_array['im_versions'][$v]['gif_capability'] : ''); $arr[$k].= ')'; @@ -2365,7 +4010,8 @@ $arr[$k].= ''; } break; - case 2: // labels, gd + // labels, gd + case 2: $arr[$k].=' ('.($v==1?'PNG':'GIF').')'; break; } @@ -2374,38 +4020,13 @@ } /** - * Returns a form-element for the localconf.php update form - * - * @param [type] $labels: ... - * @param [type] $values: ... - * @param [type] $fieldName: ... - * @param [type] $default: ... - * @param [type] $msg: ... - * @return [type] ... - */ - function getFormElement($labels,$values,$fieldName,$default,$msg='') { - $out.=''.htmlspecialchars(current($labels)).'
current value is '.htmlspecialchars($default).($msg?'
'.$msg:''); - if (count($labels)>1) { - reset($labels); - while(list($k,$v)=each($labels)) { - list($cleanV) =explode('|',$values[$k]); - $options.=''; - } - $out.='
'; - } else { - $out.=''; - } - return $out.'
'; - } - - /** * Returns the list of available databases (with access-check based on username/password) * - * @return [type] ... + * @return array List of available databases */ - function getDatabaseList() { - $dbArr=array(); - if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { + function getDatabaseList() { + $dbArr = array(); + if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) { $dbArr = $GLOBALS['TYPO3_DB']->admin_get_dbs(); } return $dbArr; @@ -2425,9 +4046,9 @@ * - im_path (default to 4.2.9, preferable with LZW) im_ver5-flag is set based on im_path being 4.2.9 or 5+ * - im_path_lzw (default to LZW version, pref. 4.2.9) * - * @return [type] ... + * @return array Suggested setup */ - function setupGeneralCalculate() { + function setupGeneralCalculate() { $formArray['disable_exec_function']=array(0); $formArray['im_path']=array(''); $formArray['im_path_lzw']=array(''); @@ -2435,10 +4056,10 @@ $formArray['im_version_5']=array(''); $formArray['im']=array(1); $formArray['gdlib']=array(1); - if ($this->config_array['gd'] && ($this->config_array['gd_gif'] || $this->config_array['gd_png'])) { - if ($this->config_array['gd_gif'] && !$this->config_array['gd_png']) { + if ($this->config_array['gd'] && ($this->config_array['gd_gif'] || $this->config_array['gd_png'])) { + if ($this->config_array['gd_gif'] && !$this->config_array['gd_png']) { $formArray['gdlib_png']=array(0); - } elseif (!$this->config_array['gd_gif'] && $this->config_array['gd_png']) { + } elseif (!$this->config_array['gd_gif'] && $this->config_array['gd_png']) { $formArray['gdlib_png']=array(1); } else { $formArray['gdlib_png']=array(0,1); @@ -2446,23 +4067,21 @@ } else { $formArray['gdlib']=array(0); } - if ($this->config_array['safemode']) { + if ($this->config_array['safemode']) { $formArray['disable_exec_function']=array(1); } - if ($this->config_array['im']) { - $formArray['im']=array(1); - $LZW_found=0; - $found=0; - reset($this->config_array['im_versions']); - $totalArr=array(); - while(list($path,$dat)=each($this->config_array['im_versions'])) { - if (count($dat)>=3) { - if (doubleval($dat['convert'])<5) { + if ($this->config_array['im']) { + $formArray['im'] = array(1); + $found = $LZW_found = 0; + $totalArr = array(); + foreach ($this->config_array['im_versions'] as $path => $dat) { + if (count($dat)>=3) { + if (doubleval($dat['convert'])<5) { $formArray['im_version_5']=array(0); - if ($dat['gif_capability']=='LZW') { + if ($dat['gif_capability']=='LZW') { $formArray['im_path']=array($path); $found=2; - } elseif ($found<2) { + } elseif ($found<2) { $formArray['im_path']=array($path); $found=1; } @@ -2471,7 +4090,7 @@ if ($dat['gif_capability'] == 'LZW') { $formArray['im_path'] = array($path); $found = 2; - } elseif ($found < 2) { + } elseif ($found < 2) { $formArray['im_path'] = array($path); $found = 1; } @@ -2480,22 +4099,22 @@ $formArray['im_path']=array($path); $found=1; } - } elseif ($dat['gm']) { + } elseif ($dat['gm']) { $formArray['im_version_5']=array('gm'); - if ($dat['gif_capability']=='LZW') { + if ($dat['gif_capability']=='LZW') { $formArray['im_path']=array($path); $found=2; - } elseif ($found<2) { + } elseif ($found<2) { $formArray['im_path']=array($path); $found=1; } } - if ($dat['gif_capability']=='LZW') { - if (doubleval($dat['convert'])<5 || !$LZW_found) { + if ($dat['gif_capability']=='LZW') { + if (doubleval($dat['convert'])<5 || !$LZW_found) { $formArray['im_path_lzw']=array($path); $LZW_found=1; } - } elseif ($dat['gif_capability']=="RLE" && !$LZW_found) { + } elseif ($dat['gif_capability']=="RLE" && !$LZW_found) { $formArray['im_path_lzw']=array($path); } $totalArr[]=$path; @@ -2512,9 +4131,9 @@ /** * Returns the part of phpinfo() output that tells about GD library (HTML-code) * - * @return [type] ... + * @return string HTML GD Library part */ - function getGDPartOfPhpinfo() { + function getGDPartOfPhpinfo() { ob_start(); phpinfo(); $contents = ob_get_contents(); @@ -2528,36 +4147,40 @@ } /** - * Returns true if TTF lib is install according to phpinfo(). If $phpinfo supply as parameter that string is searched instead. + * Returns true if TTF lib is install according to phpinfo(). + * If $phpinfo supply as parameter that string is searched instead. * - * @param [type] $phpinfo: ... - * @return [type] ... + * @param string $phpinfo PHPinfo HTML + * @return boolean TRUE if TrueType support */ - function isTTF($phpinfo='') { + function isTTF($phpinfo='') { /* $phpinfo = $phpinfo?$phpinfo:$this->getGDPartOfPhpinfo(); if (stristr($phpinfo, $this->getTTF_string)) return 1; if (stristr($phpinfo, $this->getTTF_string_alt)) return 1; */ - if (!function_exists('imagettftext')) return 0; // Return right away if imageTTFtext does not exist. + // Return right away if imageTTFtext does not exist. + if (!function_exists('imagettftext')) { + return 0; + } // try, print truetype font: - $im = @imagecreate (300, 50); - $background_color = imagecolorallocate ($im, 255, 255, 55); - $text_color = imagecolorallocate ($im, 233, 14, 91); + $im = @imagecreate(300, 50); + $background_color = imagecolorallocate($im, 255, 255, 55); + $text_color = imagecolorallocate($im, 233, 14, 91); $test = @imagettftext($im, t3lib_div::freetypeDpiComp(20), 0, 10, 20, $text_color, PATH_t3lib."/fonts/vera.ttf", 'Testing Truetype support'); - if (t3lib_div::_GP('testingTrueTypeSupport')) { - if ($this->isGIF()) { - header ('Content-type: image/gif'); - imagegif ($im); + if (t3lib_div::_GP('testingTrueTypeSupport')) { + if ($this->isGIF()) { + header('Content-type: image/gif'); + imagegif($im); } else { - header ('Content-type: image/png'); - imagepng ($im); + header('Content-type: image/png'); + imagepng($im); } exit; } - return is_array($test)?1:0; + return (is_array($test) ? 1 : 0); } @@ -2580,83 +4203,106 @@ */ /** - * @return [type] ... + * Check if GD module is available by checking the function imagecreate + * + * @return boolean TRUE if GD is available */ - function isGD() { - if (function_exists('imagecreate')) { - if (@imagecreate (50, 100)) return 1; + function isGD() { + if (function_exists('imagecreate')) { + if (@imagecreate(50, 100)) { + return 1; + } } + return 0; } /** - * [Describe function...] + * Check if GIF functions are available * - * @return [type] ... + * @return boolean TRUE if GIF functions are available */ - function isGIF() { - if (function_exists('imagecreatefromgif') && function_exists('imagegif') && ($this->ImageTypes() & IMG_GIF)) { // If GIF-functions exists, also do a real test of them: + function isGIF() { + // If GIF-functions exists, also do a real test of them: + if (function_exists('imagecreatefromgif') && function_exists('imagegif') && ($this->ImageTypes() & IMG_GIF)) { $im = @imagecreatefromgif(t3lib_extMgm::extPath('install').'imgs/jesus.gif'); - return $im?1:0; + return ($im ? 1 : 0); } } /** - * [Describe function...] + * Check if JPG functions are available * - * @return [type] ... + * @return boolean TRUE if JPEG functions are available */ - function isJPG() { - if (function_exists('imagecreatefromjpeg') && function_exists('imagejpeg') && ($this->ImageTypes() & IMG_JPG)) { + function isJPG() { + if (function_exists('imagecreatefromjpeg') && function_exists('imagejpeg') && ($this->ImageTypes() & IMG_JPG)) { return 1; } } /** - * [Describe function...] + * Check if PNG functions are available * - * @return [type] ... + * @return boolean TRUE if PNG functions are available */ - function isPNG() { - if (function_exists('imagecreatefrompng') && function_exists('imagepng') && ($this->ImageTypes() & IMG_PNG)) { + function isPNG() { + if (function_exists('imagecreatefrompng') && function_exists('imagepng') && ($this->ImageTypes() & IMG_PNG)) { $im = imagecreatefrompng(t3lib_extMgm::extPath('install').'imgs/jesus.png'); - return $im?1:0; + return ($im ? 1 : 0); } } /** - * [Describe function...] + * Return the image types supported by this PHP build * - * @return [type] ... + * @return integer A bit-field corresponding to the image formats supported by the version of GD linked into PHP. The following bits are returned, IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM. */ - function ImageTypes() { + function ImageTypes() { return imagetypes(); } /** * Returns general information about GDlib * - * @return [type] ... + * @return string HTML with GD lib information */ - function getGDSoftwareInfo() { - return trim(' - You can get GDLib in the PNG version from ' . $this->linkIt('http://www.libgd.org/') . - '.
FreeType is for download at ' . $this->linkIt('http://www.freetype.org/') . - '.
Generally, TYPO3 packages are listed at ' . $this->linkIt('http://typo3.org/download/packages/') . '.' - ); + function getGDSoftwareInfo() { + return ' +

+ You can get GDLib in the PNG version from + http://www.libgd.org/ +
+ FreeType is for download at + http://www.freetype.org/ +
+ Generally, TYPO3 packages are listed at + http://typo3.org/download/packages/ +

+ '; } /** * Returns general information about configuration of TYPO3. * - * @return [type] ... + * @return string HTML with the general information */ - function generallyAboutConfiguration() { - $out=' - Local configuration is done by overriding default values in the included file, typo3conf/localconf.php. In this file you enter the database information along with values in the global array TYPO3_CONF_VARS. - The options in the TYPO3_CONF_VARS array and how to use it for your own purposes is discussed in the base configuration file, t3lib/config_default.php. This file sets up the default values and subsequently includes the localconf.php file in which you can then override values. - See this page for '.$this->linkIt('http://typo3.org/1275.0.html','more information about system requirements.').' - '; - return trim($out); + function generallyAboutConfiguration() { + return ' +

+ Local configuration is done by overriding default values in the + included file, typo3conf/localconf.php. In this file you enter the + database information along with values in the global array + TYPO3_CONF_VARS. +
+ The options in the TYPO3_CONF_VARS array and how to use it for your + own purposes is discussed in the base configuration file, + t3lib/config_default.php. This file sets up the default values and + subsequently includes the localconf.php file in which you can then + override values. +
+ See this page for more + information about system requirements. +

'; } @@ -2708,44 +4354,110 @@ * * From TypoScript: (GD only, GD+IM, IM) * - * @return [type] ... + * @return void */ - function checkTheImageProcessing() { - $this->message('Image Processing','What is it?'," - TYPO3 is known for its ability to process images on the server. - In the backend interface (TBE) thumbnails are automatically generated (by ImageMagick in thumbs.php) as well as icons, menu items and pane tabs (by GDLib). - In the TypoScript enabled frontend all kinds of graphical elements are processed. Typically images are scaled down to fit the pages (by ImageMagick) and menu items, graphical headers and such are generated automatically (by GDLib + ImageMagick). - In addition TYPO3 is able to handle many file formats (thanks to ImageMagick), for example TIF, BMP, PCX, TGA, AI and PDF in addition to the standard web formats; JPG, GIF, PNG. + function checkTheImageProcessing() { + $this->message('Image Processing', 'What is it?', ' +

+ TYPO3 is known for its ability to process images on the server. +
+ In the backend interface (TBE) thumbnails are automatically + generated (by ImageMagick in thumbs.php) as well as icons, menu + items and pane tabs (by GDLib). +
+ In the TypoScript enabled frontend all kinds of graphical + elements are processed. Typically images are scaled down to fit + the pages (by ImageMagick) and menu items, graphical headers and + such are generated automatically (by GDLib + ImageMagick). +
+ In addition TYPO3 is able to handle many file formats (thanks to + ImageMagick), for example TIF, BMP, PCX, TGA, AI and PDF in + addition to the standard web formats; JPG, GIF, PNG. +

+

+ In order to do this, TYPO3 uses two sets of tools: +

+

+ ImageMagick: +
+ For conversion of non-web formats to webformats, combining + images with alpha-masks, performing image-effects like blurring + and sharpening. +
+ ImageMagick is a collection of external programs on the server + called by the exec() function in PHP. TYPO3 uses three of these, + namely \'convert\' (converting fileformats, scaling, effects), + \'combine\'/\'composite\' (combining images with masks) and + \'identify\' (returns image information). +
+ Because ImageMagick are external programs, two requirements must + be met: 1) The programs must be installed on the server and + working and 2) if safe_mode is enabled, the programs must be + located in the folder defined by the php.ini setting, + safe_mode_exec_dir (else they are not executed). +
+ ImageMagick is available for both Windows and Unix. The current + version is 5+, but TYPO3 enthusiasts prefer an old version 4.2.9 + because that version has three main advantages: It\'s faster in + some operations, the blur-function works, the sharpen-function + works. Anyway you do it, you must tell TYPO3 by configuration + whether you\'re using version 5+ or 4.2.9. (flag: + [GFX][im_version_5]) +
+ ImageMagick homepage is at http://www.imagemagick.org/ +

+

+ GDLib: +
+ For drawing boxes and rendering text on images with truetype + fonts. Also used for icons, menuitems and generally the + TypoScript GIFBUILDER object is based on GDlib, but extensively + utilizing ImageMagick to process intermediate results. +
+ GDLib is accessed through internal functions in PHP, so in this + case, you have no safe_mode problems, but you\'ll need a version + of PHP with GDLib compiled in. Also in order to use TrueType + fonts with GDLib you\'ll need FreeType compiled in as well. +
+

+ ' . $this->getGDSoftwareInfo() . ' +

+ You can disable all image processing options in TYPO3 + ([GFX][image_processing]=0), but that would seriously disable + TYPO3. +

+ '); - In order to do this, TYPO3 uses two sets of tools: - - ImageMagick: - For conversion of non-web formats to webformats, combining images with alpha-masks, performing image-effects like blurring and sharpening. - ImageMagick is a collection of external programs on the server called by the exec() function in PHP. TYPO3 uses three of these, namely 'convert' (converting fileformats, scaling, effects), 'combine'/'composite' (combining images with masks) and 'identify' (returns image information). - Because ImageMagick are external programs, two requirements must be met: 1) The programs must be installed on the server and working and 2) if safe_mode is enabled, the programs must be located in the folder defined by the php.ini setting, safe_mode_exec_dir (else they are not executed). - ImageMagick is available for both Windows and Unix. The current version is 5+, but TYPO3 enthusiasts prefer an old version 4.2.9 because that version has three main advantages: It's faster in some operations, the blur-function works, the sharpen-function works. Anyway you do it, you must tell TYPO3 by configuration whether you're using version 5+ or 4.2.9. (flag: [GFX][im_version_5]) - ImageMagick homepage is at ".$this->linkIt('http://www.imagemagick.org/')." - - GDLib: - For drawing boxes and rendering text on images with truetype fonts. Also used for icons, menuitems and generally the TypoScript GIFBUILDER object is based on GDlib, but extensively utilizing ImageMagick to process intermediate results. - GDLib is accessed through internal functions in PHP, so in this case, you have no safe_mode problems, but you'll need a version of PHP with GDLib compiled in. Also in order to use TrueType fonts with GDLib you'll need FreeType compiled in as well. - ".$this->getGDSoftwareInfo().' - - You can disable all image processing options in TYPO3 ([GFX][image_processing]=0), but that would seriously disable TYPO3. + $this->message('Image Processing', 'Verifying the image processing capabilities of your server', ' +

+ This page performs image processing and displays the result. + It\'s a thorough check that everything you\'ve configured is + working correctly. +
+ It\'s quite simple to verify your installation; Just look down + the page, the images in pairs should look like each other. If + some images are not alike, something is wrong. You may also + notice warnings and errors if this tool found signs of any + problems. +

+

+ The image to the right is the reference image (how it should be) + and to the left the image made by your server. +
+ The reference images are made with the classic ImageMagick + install based on the 4.2.9 RPM and 5.2.3 RPM. If the version 5 + flag is set, the reference images are made by the 5.2.3 RPM. +

+

+ This test will work only if your ImageMagick/GDLib configuration + allows it to. The typo3temp/ folder must be writable for all the + temporary image files. They are all prefixed \'install_\' so + they are easy to recognize and delete afterwards. +

'); - $this->message('Image Processing','Verifying the image processing capabilities of your server'," - This page performs image processing and displays the result. It's a thorough check that everything you've configured is working correctly. - It's quite simple to verify your installation; Just look down the page, the images in pairs should look like each other. If some images are not alike, something is wrong. You may also notice warnings and errors if this tool found signs of any problems. - - The image to the right is the reference image (how it should be) and to the left the image made by your server. - The reference images are made with the classic ImageMagick install based on the 4.2.9 RPM and 5.2.3 RPM. If the version 5 flag is set, the reference images are made by the 5.2.3 RPM. - - This test will work only if your ImageMagick/GDLib configuration allows it to. The typo3temp/ folder must be writable for all the temporary image files. They are all prefixed 'install_' so they are easy to recognize and delete afterwards. - "); - $im_path = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path']; - if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']=='gm') { + if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']=='gm') { $im_path_version = $this->config_array['im_versions'][$im_path]['gm']; } else { $im_path_version = $this->config_array['im_versions'][$im_path]['convert']; @@ -2753,24 +4465,86 @@ $im_path_lzw = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw']; $im_path_lzw_version = $this->config_array['im_versions'][$im_path_lzw]['convert']; $msg = ' - ImageMagick enabled: '.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im'].' - ImageMagick path: '.$im_path.' ('.$im_path_version.') - ImageMagick path/LZW: '.$im_path_lzw.' ('.$im_path_lzw_version.') - Version 5/GraphicsMagick flag: '.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'].' - - GDLib enabled: '.$GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'].' - GDLib using PNG: '.$GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png'].' - GDLib 2 enabled: '.$GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_2'].' - IM5 effects enabled: '.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_v5effects'].' (Blurring/Sharpening with IM 5+) - Freetype DPI: '.$GLOBALS['TYPO3_CONF_VARS']['GFX']['TTFdpi'].' (Should be 96 for Freetype 2) - Mask invert: '.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_imvMaskState'].' (Should be set for some IM versions approx. 5.4+) - - File Formats: '.$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'].' +
+
+ ImageMagick enabled: +
+
+ ' . $GLOBALS['TYPO3_CONF_VARS']['GFX']['im'] . ' +
+
+ ImageMagick path: +
+
+ ' . $im_path . ' (' . $im_path_version . ') +
+
+ ImageMagick path/LZW: +
+
+ ' . $im_path_lzw . ' (' . $im_path_lzw_version . ') +
+
+ Version 5/GraphicsMagick flag: +
+
+ ' . ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] : ' ') . ' +
+
+
+
+ GDLib enabled: +
+
+ ' . ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'] ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'] : ' ') . ' +
+
+ GDLib using PNG: +
+
+ ' . ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png'] ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png'] : ' ') . ' +
+
+ GDLib 2 enabled: +
+
+ ' . ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_2'] ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_2'] : ' ') . ' +
+
+ IM5 effects enabled: +
+
+ ' . $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_v5effects'] . ' + (Blurring/Sharpening with IM 5+) +
+
+ Freetype DPI: +
+
+ ' . $GLOBALS['TYPO3_CONF_VARS']['GFX']['TTFdpi'] . ' + (Should be 96 for Freetype 2) +
+
+ Mask invert: +
+
+ ' . $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_imvMaskState'] . ' + (Should be set for some IM versions approx. 5.4+) +
+
+
+
+ File Formats: +
+
+ ' . $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] . ' +
+
'; // Various checks to detect IM/GM version mismatches $mismatch=false; - switch (strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'])) { + switch (strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'])) { case 'gm': if (doubleval($im_path_version)>=2) $mismatch=true; break; @@ -2782,46 +4556,61 @@ break; } - if ($mismatch) { - $msg.= 'Warning: Mismatch between the version of ImageMagick'. - ' ('.$im_path_version.') and the configuration of '. - '[GFX][im_version_5] ('.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'].')'; + if ($mismatch) { + $msg .= ' +

+ Warning: Mismatch between the version of ImageMagick' . + ' (' . $im_path_version.') and the configuration of ' . + '[GFX][im_version_5] (' . $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] . ') +

+ '; $etype=2; } else $etype=1; - if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']=='gm') { + if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']=='gm') { $msg = str_replace('ImageMagick','GraphicsMagick',$msg); } - $this->message('Image Processing','Current configuration',$msg,$etype); + $this->message('Image Processing', 'Current configuration',$msg,$etype); - if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['image_processing']) { - $this->message('Image Processing','Image Processing disabled!'," - Image Processing is disabled by the config flag [GFX][image_processing] set to false (zero) - ",2); + if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['image_processing']) { + $this->message('Image Processing', 'Image Processing disabled!', ' +

+ Image Processing is disabled by the config flag + [GFX][image_processing] set to false (zero) +

+ ', 2); $this->output($this->outputWrapper($this->printAll())); return; } - if (!$this->config_array['dir_typo3temp']) { - $this->message('Image Processing','typo3temp/ not writable!'," - You must make typo3temp/ write enabled before you can proceed with this test. - ",2); + if (!$this->config_array['dir_typo3temp']) { + $this->message('Image Processing', 'typo3temp/ not writable!', ' +

+ You must make typo3temp/ write enabled before you can + proceed with this test. +

+ ', 2); $this->output($this->outputWrapper($this->printAll())); return; } - $msg='Click each of these links in turn to test a topic. Please be aware that each test may take several seconds!: - - '.$this->imagemenu(); + $msg = ' +

+ + Click each of these links in turn to test a topic. + + Please be aware that each test may take several seconds! + : +

+ ' . $this->imagemenu(); $this->message('Image Processing','Testmenu',$msg,''); - $this->messageFunc_nl2br=0; $parseStart = t3lib_div::milliseconds(); $imageProc = t3lib_div::makeInstance('t3lib_stdGraphic'); $imageProc->init(); @@ -2836,27 +4625,31 @@ // Very temporary!!! $imageProc->dontUnlinkTempFiles=0; - $imActive = ($this->config_array['im'] && $im_path); $gdActive = ($this->config_array['gd'] && $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']); - switch($this->INSTALL['images_type']) { + switch($this->INSTALL['images_type']) { case 'read': $refParseTime='5600'; // 4.2.9 $refParseTime='3300'; // 5.2.3 $headCode = 'Reading and converting images'; - $this->message($headCode,'Supported file formats'," - This verifies that your ImageMagick installation is able to read the nine default file formats; JPG, GIF, PNG, TIF, BMP, PCX, TGA, PDF, AI. - The tool 'identify' will be used to read the pixeldimensions of non-web formats. - The tool 'convert' is used to read the image and write a temporary JPG-file - "); + $this->message($headCode, 'Supported file formats', ' +

+ This verifies that your ImageMagick installation is able + to read the nine default file formats; JPG, GIF, PNG, + TIF, BMP, PCX, TGA, PDF, AI. The tool \'identify\' will + be used to read the pixeldimensions of non-web formats. + The tool \'convert\' is used to read the image and write + a temporary JPG-file +

+ '); - if ($imActive) { + if ($imActive) { // Reading formats - writing JPG $extArr = explode(',','jpg,gif,png,tif,bmp,pcx,tga'); - while(list(,$ext)=each($extArr)) { - if ($this->isExtensionEnabled($ext, $headCode, "Read ".strtoupper($ext))) { + foreach ($extArr as $ext) { + if ($this->isExtensionEnabled($ext, $headCode, "Read ".strtoupper($ext))) { $imageProc->IM_commands=array(); $theFile = t3lib_extMgm::extPath('install').'imgs/jesus.'.$ext; if (!@is_file($theFile)) die('Error: '.$theFile.' was not a file'); @@ -2868,7 +4661,7 @@ } } - if ($this->isExtensionEnabled('pdf', $headCode, 'Read PDF')) { + if ($this->isExtensionEnabled('pdf', $headCode, 'Read PDF')) { $imageProc->IM_commands=array(); $theFile = t3lib_extMgm::extPath('install').'imgs/pdf_from_imagemagick.pdf'; if (!@is_file($theFile)) die('Error: '.$theFile.' was not a file'); @@ -2878,7 +4671,7 @@ $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands); $this->message($headCode,'Read PDF',$result[0],$result[1]); } - if ($this->isExtensionEnabled('ai', $headCode, 'Read AI')) { + if ($this->isExtensionEnabled('ai', $headCode, 'Read AI')) { $imageProc->IM_commands=array(); $theFile = t3lib_extMgm::extPath('install').'imgs/typo3logotype.ai'; if (!@is_file($theFile)) die('Error: '.$theFile.' was not a file'); @@ -2889,10 +4682,15 @@ $this->message($headCode,'Read AI',$result[0],$result[1]); } } else { - $this->message($headCode,'Test skipped'," - Use of ImageMagick has been disabled in the configuration. - Refer to section 'Basic Configuration' to change or review you configuration settings - ",2); + $this->message($headCode, 'Test skipped', ' +

+ Use of ImageMagick has been disabled in the + configuration. +
+ Refer to section \'Basic Configuration\' to change + or review you configuration settings +

+ ', 2); } break; case 'write': @@ -2900,12 +4698,17 @@ // Writingformats - writing JPG $headCode = 'Writing images'; - $this->message($headCode,'Writing GIF and PNG',' - This verifies that ImageMagick is able to write GIF and PNG files. - The GIF-file is attempted compressed with LZW by the t3lib_div::gif_compress() function. + $this->message($headCode, 'Writing GIF and PNG', ' +

+ This verifies that ImageMagick is able to write GIF and + PNG files. +
+ The GIF-file is attempted compressed with LZW by the + t3lib_div::gif_compress() function. +

'); - if ($imActive) { + if ($imActive) { // Writing GIF $imageProc->IM_commands=array(); $theFile = t3lib_extMgm::extPath('install').'imgs/jesus.gif'; @@ -2913,7 +4716,7 @@ $imageProc->imageMagickConvert_forceFileNameBody='write_gif'; $fileInfo = $imageProc->imageMagickConvert($theFile,'gif',"",'',"",'',"",1); - if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gif_compress']) { + if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gif_compress']) { clearstatcache(); $prevSize=t3lib_div::formatSize(@filesize($fileInfo[3])); $returnCode = t3lib_div::gif_compress($fileInfo[3],''); @@ -2934,10 +4737,15 @@ $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands); $this->message($headCode,'Write PNG',$result[0],$result[1]); } else { - $this->message($headCode,'Test skipped'," - Use of ImageMagick has been disabled in the configuration. - Refer to section 'Basic Configuration' to change or review you configuration settings - ",2); + $this->message($headCode, 'Test skipped', ' +

+ Use of ImageMagick has been disabled in the + configuration. +
+ Refer to section \'Basic Configuration\' to change + or review you configuration settings +

+ ', 2); } break; case 'scaling': @@ -2945,11 +4753,14 @@ // Scaling $headCode = 'Scaling images'; - $this->message($headCode,'Scaling transparent images',' - This shows how ImageMagick reacts when scaling transparent GIF and PNG files. + $this->message($headCode, 'Scaling transparent images', ' +

+ This shows how ImageMagick reacts when scaling + transparent GIF and PNG files. +

'); - if ($imActive) { + if ($imActive) { // Scaling transparent image $imageProc->IM_commands=array(); $theFile = t3lib_extMgm::extPath('install').'imgs/jesus2_transp.gif'; @@ -2957,7 +4768,7 @@ $imageProc->imageMagickConvert_forceFileNameBody='scale_gif'; $fileInfo = $imageProc->imageMagickConvert($theFile,'gif',"150",'',"",'',"",1); - if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gif_compress']) { + if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gif_compress']) { clearstatcache(); $prevSize=t3lib_div::formatSize(@filesize($fileInfo[3])); $returnCode = t3lib_div::gif_compress($fileInfo[3],''); @@ -2985,10 +4796,15 @@ $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands); $this->message($headCode,'GIF to JPG, 150 pixels wide',$result[0],$result[1]); } else { - $this->message($headCode,'Test skipped'," - Use of ImageMagick has been disabled in the configuration. - Refer to section 'Basic Configuration' to change or review you configuration settings - ",2); + $this->message($headCode, 'Test skipped', ' +

+ Use of ImageMagick has been disabled in the + configuration. +
+ Refer to section \'Basic Configuration\' to change + or review you configuration settings +

+ ', 2); } break; case 'combining': @@ -2996,12 +4812,19 @@ $refParseTime='250'; // 5.2.3 // Combine $headCode = 'Combining images'; - $this->message($headCode,'Combining images'," - This verifies that the ImageMagick tool, 'combine'/'composite', is able to combine two images through a grayscale mask.
- If the masking seems to work but inverted, that just means you'll have to make sure the invert flag is set (some combination of im_negate_mask/im_imvMaskState) - "); + $this->message($headCode, 'Combining images', ' +

+ This verifies that the ImageMagick tool, + \'combine\'/\'composite\', is able to combine two images + through a grayscale mask. +
+ If the masking seems to work but inverted, that just + means you\'ll have to make sure the invert flag is set + (some combination of im_negate_mask/im_imvMaskState) +

+ '); - if ($imActive) { + if ($imActive) { $imageProc->IM_commands=array(); $input = t3lib_extMgm::extPath('install').'imgs/greenback.gif'; $overlay = t3lib_extMgm::extPath('install').'imgs/jesus.jpg'; @@ -3031,24 +4854,34 @@ $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands); $this->message($headCode,'Combine using a JPG mask with graylevels',$result[0],$result[1]); } else { - $this->message($headCode,'Test skipped'," - Use of ImageMagick has been disabled in the configuration. - Refer to section 'Basic Configuration' to change or review you configuration settings - ",2); + $this->message($headCode, 'Test skipped', ' +

+ Use of ImageMagick has been disabled in the + configuration. +
+ Refer to section \'Basic Configuration\' to change + or review you configuration settings +

+ ', 2); } break; case 'gdlib': - $refParseTime='1800'; // GIF / 4.2.9 / LZW (5.2.3) - $refParseTime='2700'; // PNG / 4.2.9 / LZW (5.2.3) - $refParseTime='1600'; // GIF / 5.2.3 / LZW (5.2.3) + // GIF / 4.2.9 / LZW (5.2.3) + $refParseTime='1800'; + // PNG / 4.2.9 / LZW (5.2.3) + $refParseTime='2700'; + // GIF / 5.2.3 / LZW (5.2.3) + $refParseTime='1600'; // GDLibrary $headCode = 'GDLib'; - $this->message($headCode,'Testing GDLib',' - This verifies that the GDLib installation works properly. + $this->message($headCode, 'Testing GDLib', ' +

+ This verifies that the GDLib installation works properly. +

'); - if ($gdActive) { + if ($gdActive) { // GD with box $imageProc->IM_commands=array(); $im = $imageProc->imageCreate(170,136); @@ -3067,7 +4900,7 @@ $this->message($headCode,'Create simple image',$result[0],$result[1]); - // GD from image with box + // GD from image with box $imageProc->IM_commands=array(); $input = t3lib_extMgm::extPath('install').'imgs/jesus.'.$imageProc->gifExtension; if (!@is_file($input)) die('Error: '.$input.' was not a file'); @@ -3085,7 +4918,7 @@ $this->message($headCode,'Create image from file',$result[0],$result[1]); - // GD with text + // GD with text $imageProc->IM_commands=array(); $im = $imageProc->imageCreate(170,136); $Bcolor = ImageColorAllocate ($im, 128,128,150); @@ -3110,7 +4943,7 @@ $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands); $this->message($headCode,'Render text with TrueType font',$result[0],$result[1]); - if ($imActive) { + if ($imActive) { // extension: GD with text, niceText $conf['offset'] = '17,65'; $conf['niceText'] = 1; @@ -3120,19 +4953,31 @@ $imageProc->ImageWrite($im,$output); $fileInfo = $imageProc->getImageDimensions($output); $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands, array("Note on 'niceText':","'niceText' is a concept that tries to improve the antialiasing of the rendered type by actually rendering the textstring in double size on a black/white mask, downscaling the mask and masking the text onto the image through this mask. This involves ImageMagick 'combine'/'composite' and 'convert'.")); - $this->message($headCode,"Render text with TrueType font using 'niceText' option", - "(If the image has another background color than the image above (eg. dark background color with light text) then you will have to set TYPO3_CONF_VARS[GFX][im_imvMaskState]=1)

". - $result[0],$result[1]); + $this->message($headCode, 'Render text with TrueType font using \'niceText\' option', ' +

+ (If the image has another background color than + the image above (eg. dark background color with + light text) then you will have to set + TYPO3_CONF_VARS[GFX][im_imvMaskState]=1) +

+ ' . $result[0], $result[1]); } else { - $this->message($headCode,"Render text with TrueType font using 'niceText' option"," - Test is skipped!

- - Use of ImageMagick has been disabled in the configuration. ImageMagick is needed to generate text with the niceText option. - Refer to section 'Basic Configuration' to change or review you configuration settings - ",2); + $this->message($headCode, 'Render text with TrueType font using \'niceText\' option', ' +

+ Test is skipped! +

+

+ Use of ImageMagick has been disabled in the + configuration. ImageMagick is needed to generate + text with the niceText option. +
+ Refer to section \'Basic Configuration\' to + change or review you configuration settings +

+ ', 2); } - if ($imActive) { + if ($imActive) { // extension: GD with text, niceText AND shadow $conf['offset'] = '17,90'; $conf['niceText'] = 1; @@ -3148,35 +4993,93 @@ $output = $imageProc->tempPath.$imageProc->filenamePrefix.t3lib_div::shortMD5('GDwithText-niceText-shadow').'.'.$imageProc->gifExtension; $imageProc->ImageWrite($im,$output); $fileInfo = $imageProc->getImageDimensions($output); - $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands, array('Note on drop shadows:','Drop shadows are done by using ImageMagick to blur a mask through which the drop shadow is generated. The blurring of the mask only works in ImageMagick 4.2.9 and not ImageMagick 5 - which is why you may see a hard and not soft shadow.')); - $this->message($headCode,"Render 'niceText' with a shadow under", - "(This test makes sense only if the above test had a correct output. But if so, you may not see a soft dropshadow from the third text string as you should. In that case you are most likely using ImageMagick 5 and should set the flag TYPO3_CONF_VARS[GFX][im_v5effects]. However this may cost server performance!
Finally if you see no drop shadow at all or if the shadow is still not soft, then check if you are using GDlib2 and if so set TYPO3_CONF_VARS[GFX][gdlib_2]=1)

". - $result[0],$result[1]); + $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands, array('Note on drop shadows:','Drop shadows are done by using ImageMagick to blur a mask through which the drop shadow is generated. The blurring of the mask only works in ImageMagick 4.2.9 and not ImageMagick 5 - which is why you may see a hard and not soft shadow.')); + $this->message($headCode, 'Render \'niceText\' with a shadow under', ' +

+ (This test makes sense only if the above test + had a correct output. But if so, you may not see + a soft dropshadow from the third text string as + you should. In that case you are most likely + using ImageMagick 5 and should set the flag + TYPO3_CONF_VARS[GFX][im_v5effects]. However this + may cost server performance! +
+ Finally if you see no drop shadow at all or if + the shadow is still not soft, then check if you + are using GDlib2 and if so set + TYPO3_CONF_VARS[GFX][gdlib_2]=1) +

+ ' . $result[0], $result[1]); } else { - $this->message($headCode,"Render 'niceText' with a shadow under"," - Test is skipped!

- - Use of ImageMagick has been disabled in the configuration. ImageMagick is needed to generate shadows. - Refer to section 'Basic Configuration' to change or review you configuration settings - ",2); + $this->message($headCode, 'Render \'niceText\' with a shadow under', ' +

+ Test is skipped! +

+

+ Use of ImageMagick has been disabled in the + configuration. ImageMagick is needed to generate + shadows. +
+ Refer to section \'Basic Configuration\' to + change or review you configuration settings +

+ ', 2); } - if ($imageProc->gifExtension=='gif') { + if ($imageProc->gifExtension=='gif') { $buffer=20; $assess = "This assessment is based on the filesize from 'Create image from file' test, which were ".$GDWithBox_filesize.' bytes'; $goodNews = "If the image was LZW compressed you would expect to have a size of less than 9000 bytes. If you open the image with Photoshop and saves it from Photoshop, you'll a filesize like that.
The good news is (hopefully) that your [GFX][im_path_lzw] path is correctly set so the gif_compress() function will take care of the compression for you!"; - if ($GDWithBox_filesize<8784+$buffer) { - $msg="Your GDLib appears to have LZW compression!
- This assessment is based on the filesize from 'Create image from file' test, which were ".$GDWithBox_filesize." bytes.
- This is a real advantage for you because you don't need to use ImageMagick for LZW compressing. In order to make sure that GDLib is used, please set the config option [GFX][im_path_lzw] to an empty string!
- When you disable the use of ImageMagick for LZW compressing, you'll see that the gif_compress() function has a return code of 'GD' (for GDLib) instead of 'IM' (for ImageMagick) - "; - } elseif ($GDWithBox_filesize>19000) { - $msg='Your GDLib appears to have no compression at all!
- '.$assess.'
'.$goodNews; + if ($GDWithBox_filesize<8784+$buffer) { + $msg = ' +

+ + Your GDLib appears to have LZW compression! + +
+ This assessment is based on the filesize + from \'Create image from file\' test, which + were ' . $GDWithBox_filesize . ' bytes. +
+ This is a real advantage for you because you + don\'t need to use ImageMagick for LZW + compressing. In order to make sure that + GDLib is used, + + please set the config option + [GFX][im_path_lzw] to an empty string! + +
+ When you disable the use of ImageMagick for + LZW compressing, you\'ll see that the + gif_compress() function has a return code of + \'GD\' (for GDLib) instead of \'IM\' (for + ImageMagick) +

+ '; + } elseif ($GDWithBox_filesize>19000) { + $msg = ' +

+ + Your GDLib appears to have no + compression at all! + +
+ ' . $assess . ' +
+ ' . $goodNews . ' +

+ '; } else { - $msg='Your GDLib appears to have RLE compression
- '.$assess.'
'.$goodNews; + $msg = ' +

+ Your GDLib appears to have RLE compression +
+ ' . $assess . ' +
+ ' . $goodNews . ' +

+ '; } $this->message($headCode,'GIF compressing in GDLib'," ".$msg." @@ -3184,159 +5087,314 @@ } } else { - $this->message($headCode,'Test skipped'," - Use of GDLib has been disabled in the configuration. - Refer to section 'Basic Configuration' to change or review you configuration settings - ",2); + $this->message($headCode, 'Test skipped', ' +

+ Use of GDLib has been disabled in the configuration. +
+ Refer to section \'Basic Configuration\' to change + or review you configuration settings +

+ ', 2); } break; } - if ($this->INSTALL['images_type']) { + if ($this->INSTALL['images_type']) { // End info - if ($this->fatalError) { - $this->message('Info','Errors'," - It seems that you had some fatal errors in this test. Please make sure that your ImageMagick and GDLib settings are correct. - Refer to the 'Basic Configuration' section for more information and debugging of your settings. - "); + if ($this->fatalError) { + $this->message('Info', 'Errors', ' +

+ It seems that you had some fatal errors in this test. + Please make sure that your ImageMagick and GDLib + settings are correct. Refer to the + \'Basic Configuration\' section for more information and + debugging of your settings. +

+ '); } $parseMS = t3lib_div::milliseconds() - $parseStart; - $this->message('Info','Parsetime',$parseMS.' ms'); + $this->message('Info', 'Parsetime', ' +

+ ' . $parseMS . ' ms +

+ '); } $this->output($this->outputWrapper($this->printAll())); } /** - * [Describe function...] + * Check if image file extension is enabled + * Adds error message to the message array * - * @param [type] $ext: ... - * @param [type] $headCode: ... - * @param [type] $short: ... - * @return [type] ... + * @param string $ext The image file extension + * @param string $headCode The header for the message + * @param string $short The short description for the message + * @return boolean TRUE if extension is enabled */ - function isExtensionEnabled($ext, $headCode, $short) { - if (!t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$ext)) { - $this->message($headCode,$short,'Skipped - extension not in the list of allowed extensions ([GFX][imagefile_ext]).',1); + function isExtensionEnabled($ext, $headCode, $short) { + if (!t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$ext)) { + $this->message($headCode, $short, ' +

+ Skipped - extension not in the list of allowed extensions + ([GFX][imagefile_ext]). +

+ ',1); } else { return 1; } } /** - * [Describe function...] + * Generate the HTML after reading and converting images + * Displays the verification and the converted image if succeeded + * Adds error messages if needed * - * @param [type] $imageFile: ... - * @param [type] $IMcommands: ... - * @param [type] $note: ... - * @return [type] ... + * @param string $imageFile The file name of the converted image + * @param array $IMcommands The ImageMagick commands used + * @param string $note Additional note for image operation + * @return array Contains content and highest error level */ - function displayTwinImage ($imageFile, $IMcommands=array(), $note='') { - $ex_rows=''; + function displayTwinImage ($imageFile, $IMcommands=array(), $note='') { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'DisplayTwinImage.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + + $content = ''; + $errorLevels=array(-1); - if ($imageFile) { + if ($imageFile) { + // Get the subpart for the images + $imageSubpart = $this->contentObject->getSubpart($template, '###IMAGE###'); $verifyFile = t3lib_extMgm::extPath('install').'verify_imgs/'.basename($imageFile); -#debug(array($imageFile,$this->backPath.'../'.substr($imageFile,strlen(PATH_site))),1); $destImg = @getImageSize($imageFile); $destImgCode =''; $verifyImg = @getImageSize($verifyFile); $verifyImgCode = ''; - if (!$verifyImg) { - $gifVersion=1; - $verifyFile_alt = substr($verifyFile,0,-3).'gif'; - $verifyImg = @getImageSize($verifyFile_alt); - if ($verifyImg) { -// FIXME what is that? old code? t3lib/install/verify_imgs/ do not exist - $verifyImgCode = ''; - $verifyImgCode= '
'.$verifyImgCode.'
'.$this->fw('NO REFERENCE FOUND!

GIF version looks like this.').'
'; - } else { - $verifyImgCode= '
'.$this->fw('NO REFERENCE FOUND!

'.basename($verifyFile)).'
'; - } - } clearstatcache(); $destImg['filesize'] = @filesize($imageFile); clearstatcache(); $verifyImg['filesize'] = @filesize($verifyFile); + // Define the markers content + $imageMarkers = array( + 'destWidth' => $destImg[0], + 'destHeight' => $destImg[1], + 'destUrl' => $this->backPath . '../' . substr($imageFile, strlen(PATH_site)), + 'verifyWidth' => $verifyImg[0], + 'verifyHeight' => $verifyImg[1], + 'verifyUrl' => $this->backPath . t3lib_extMgm::extRelPath('install') . 'verify_imgs/' . basename($verifyFile), + 'yourServer' => 'Your server:', + 'yourServerInformation' => t3lib_div::formatSize($destImg['filesize']) . ', ' . $destImg[0] . 'x' . $destImg[1] . ' pixels', + 'reference' => 'Reference:', + 'referenceInformation' => t3lib_div::formatSize($verifyImg['filesize']) . ', ' . $verifyImg[0] . 'x' . $verifyImg[1] . ' pixels' + ); - $ex_rows.=''; - $ex_rows.=''.$destImgCode.''; - $ex_rows.=''; - $ex_rows.=''.$verifyImgCode.''; - $ex_rows.=''; + // Display a warning if the generated image is more than 2KB larger than its reference... + if (($destImg['filesize']!=$verifyImg['filesize']) && (intval($destImg['filesize']) && ($destImg['filesize']-$verifyImg['filesize']) > 2048)) { + // Get the subpart for the different filesize message + $differentFileSizeSubpart = $this->contentObject->getSubpart($imageSubpart, '###DIFFERENTFILESIZE###'); + // Define the markers content + $differentFileSizeMarkers = array( + 'message' => 'File size is very different from reference', + 'yourServerFileSize' => $destImg['filesize'], + 'referenceFileSize' => $verifyImg['filesize'] + ); + // Fill the markers in the subpart + $differentFileSizeSubpart = $this->contentObject->substituteMarkerArray( + $differentFileSizeSubpart, + $differentFileSizeMarkers, + '###|###', + 1, + 1 + ); - $ex_rows.=$this->getTwinImageMessage('', 'Your server:', 'Reference:'); - $ex_rows.=$this->getTwinImageMessage('', t3lib_div::formatSize($destImg['filesize']).', '.$destImg[0].'x'.$destImg[1].' pixels', t3lib_div::formatSize($verifyImg['filesize']).', '.$verifyImg[0].'x'.$verifyImg[1].' pixels'); - - if (($destImg['filesize']!=$verifyImg['filesize']) && (intval($destImg['filesize']) && ($destImg['filesize']-$verifyImg['filesize']) > 2048)) { // Display a warning if the generated image is more than 2KB larger than its reference... - $ex_rows.=$this->getTwinImageMessage('File size is very different from reference', $destImg['filesize'], $verifyImg['filesize']); $errorLevels[]=2; } - if ($destImg[0]!=$verifyImg[0] || $destImg[1]!=$verifyImg[1]) { - $ex_rows.=$this->getTwinImageMessage('Pixel dimension are not equal!'); + // Substitute the subpart for different filesize message + $imageSubpart = $this->contentObject->substituteSubpart( + $imageSubpart, + '###DIFFERENTFILESIZE###', + $differentFileSizeSubpart + ); + + if ($destImg[0]!=$verifyImg[0] || $destImg[1]!=$verifyImg[1]) { + // Get the subpart for the different pixel dimensions message + $differentPixelDimensionsSubpart = $this->contentObject->getSubpart($imageSubpart, '###DIFFERENTPIXELDIMENSIONS###'); + // Define the markers content + $differentPixelDimensionsMarkers = array( + 'message' => 'Pixel dimension are not equal!' + ); + // Fill the markers in the subpart + $differentPixelDimensionsSubpart = $this->contentObject->substituteMarkerArray( + $differentPixelDimensionsSubpart, + $differentPixelDimensionsMarkers, + '###|###', + 1, + 1 + ); + $errorLevels[]=2; } - if ($note) { - $ex_rows.=$this->getTwinImageMessage($note[0],$note[1]); + // Substitute the subpart for different pixel dimensions message + $imageSubpart = $this->contentObject->substituteSubpart( + $imageSubpart, + '###DIFFERENTPIXELDIMENSIONS###', + $differentPixelDimensionsSubpart + ); + + if ($note) { + // Get the subpart for the note + $noteSubpart = $this->contentObject->getSubpart($imageSubpart, '###NOTE###'); + // Define the markers content + $noteMarkers = array( + 'message' => $note[0], + 'label' => $note[1] + ); + // Fill the markers in the subpart + $noteSubpart = $this->contentObject->substituteMarkerArray( + $noteSubpart, + $noteMarkers, + '###|###', + 1, + 1 + ); } - if ($this->dumpImCommands && count($IMcommands)) { - $ex_rows.=$this->getTwinImageMessage('ImageMagick commands executed:',$this->formatImCmds($IMcommands)); + // Substitute the subpart for the note + $imageSubpart = $this->contentObject->substituteSubpart( + $imageSubpart, + '###NOTE###', + $noteSubpart + ); + + if ($this->dumpImCommands && count($IMcommands)) { + $commands = $this->formatImCmds($IMcommands); + // Get the subpart for the ImageMagick commands + $imCommandsSubpart = $this->contentObject->getSubpart($imageSubpart, '###IMCOMMANDS###'); + // Define the markers content + $imCommandsMarkers = array( + 'message' => 'ImageMagick commands executed:', + 'rows' => t3lib_div::intInRange(count($commands), 2, 10), + 'commands' => htmlspecialchars(implode($commands, chr(10))) + ); + // Fill the markers in the subpart + $imCommandsSubpart = $this->contentObject->substituteMarkerArray( + $imCommandsSubpart, + $imCommandsMarkers, + '###|###', + 1, + 1 + ); } + // Substitute the subpart for the ImageMagick commands + $imageSubpart = $this->contentObject->substituteSubpart( + $imageSubpart, + '###IMCOMMANDS###', + $imCommandsSubpart + ); + // Fill the markers + $imageSubpart = $this->contentObject->substituteMarkerArray( + $imageSubpart, + $imageMarkers, + '###|###', + 1, + 1 + ); + } else { - $ex_rows.=$this->getTwinImageMessage('There was no result from the ImageMagick operation', "Below there's a dump of the ImageMagick commands executed:
".$this->formatImCmds($IMcommands)); + // Get the subpart when no image has been generated + $noImageSubpart = $this->contentObject->getSubpart($template, '###NOIMAGE###'); + $commands = $this->formatImCmds($IMcommands); + + if (count($commands)) { + // Get the subpart for the ImageMagick commands + $commandsSubpart = $this->contentObject->getSubpart($noImageSubpart, '###COMMANDSAVAILABLE###'); + // Define the markers content + $commandsMarkers = array( + 'rows' => t3lib_div::intInRange(count($commands), 2, 10), + 'commands' => htmlspecialchars(implode($commands, chr(10))) + ); + // Fill the markers in the subpart + $commandsSubpart = $this->contentObject->substituteMarkerArray( + $commandsSubpart, + $commandsMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for the ImageMagick commands + $noImageSubpart = $this->contentObject->substituteSubpart( + $noImageSubpart, + '###COMMANDSAVAILABLE###', + $commandsSubpart + ); + // Define the markers content + $noImageMarkers = array( + 'message' => 'There was no result from the ImageMagick operation', + 'label' => 'Below there\'s a dump of the ImageMagick commands executed:' + ); + // Fill the markers + $noImageSubpart = $this->contentObject->substituteMarkerArray( + $noImageSubpart, + $noImageMarkers, + '###|###', + 1, + 1 + ); + $errorLevels[]=3; } - $out=''.$ex_rows.'
'; + // Substitute the subpart when image has been generated + $content = $this->contentObject->substituteSubpart( + $template, + '###IMAGE###', + $imageSubpart + ); + // Substitute the subpart when no image has been generated + $content = $this->contentObject->substituteSubpart( + $content, + '###NOIMAGE###', + $noImageSubpart + ); - return array($out,max($errorLevels)); + return array($content, max($errorLevels)); } /** - * [Describe function...] + * Format ImageMagick commands for use in HTML * - * @param [type] $message: ... - * @param [type] $label_1: ... - * @param [type] $label_2: ... - * @return [type] ... + * @param array $arr The ImageMagick commands + * @return string The formatted commands */ - function getTwinImageMessage($message, $label_1="", $label_2='') { - if ($message) $out.=''.$this->fw($message).''; - if ($label_1 && !$label_2) { - $out.=''.$this->fw($label_1).''; - } elseif ($label_1 || $label_2) { - $out.=''.$this->fw($label_1).''.$this->fw($label_2).''; + function formatImCmds($arr) { + $out = array(); + if (is_array($arr)) { + foreach ($arr as $k => $v) { + $out[] = $v[1]; + if ($v[2]) { + $out[]=' RETURNED: ' . $v[2]; + } + } } + return $out; } /** - * [Describe function...] + * Generate the menu for the test menu in 'image processing' * - * @param [type] $arr: ... - * @return [type] ... + * @return string The HTML for the test menu */ - function formatImCmds($arr) { - $out=array(); - if (is_array($arr)) { - reset($arr); - while(list($k,$v)=each($arr)) { - $out[]=$v[1]; - if ($v[2]) $out[]=' RETURNED: '.$v[2]; - } - } - if (count($out)) { - $col = t3lib_div::intInRange(count($out),2,10); - $outputStr = ''; - return '
'.$outputStr.'
'; - }; - } + function imagemenu() { + // Get the template file + $template = @file_get_contents(PATH_site . $this->templateFilePath . 'ImageMenu.html'); + // Get the subpart for the menu + $menuSubPart = $this->contentObject->getSubpart($template, '###MENU###'); + // Get the subpart for the single item in the menu + $menuItemSubPart = $this->contentObject->getSubpart($menuSubPart, '###MENUITEM###'); - /** - * [Describe function...] - * - * @return [type] ... - */ - function imagemenu() { $menuitems = array( 'read' => 'Reading image formats', 'write' => 'Writing GIF and PNG', @@ -3344,18 +5402,32 @@ 'combining' => 'Combining images', 'gdlib' => 'GD library functions' ); - reset($menuitems); - $c=0; - $out=array(); - while(list($k,$v)=each($menuitems)) { - $bgcolor = ($this->INSTALL['images_type']==$k ? ' class="activeMenu"' : ' class="generalTableBackground"'); - $c++; - $out[]=''.$this->fw($c.': '.$v).''; + $c = 0; + + foreach ($menuitems as $k => $v) { + // Define the markers content + $markers = array( + 'backgroundColor' => $this->INSTALL['images_type'] == $k ? 'activeMenu' : 'generalTableBackground', + 'url' => htmlspecialchars($this->action . '&TYPO3_INSTALL[images_type]=' . $k . '#imageMenu'), + 'item' => $v + ); + // Fill the markers in the subpart + $items[] = $this->contentObject->substituteMarkerArray( + $menuItemSubPart, + $markers, + '###|###', + 1, + 1 + ); } + // Substitute the subpart for the single item in the menu + $menuSubPart = $this->contentObject->substituteSubpart( + $menuSubPart, + '###MENUITEM###', + implode(chr(10), $items) + ); - $code = ''.implode($out,'').'
'; - $code = '
'.$code.'
'; - return '
'.$code.'
'; + return $menuSubPart; } @@ -3376,20 +5448,32 @@ **********************/ /** - * @return [type] ... + * The Database Analyzer + * + * @return void */ - function checkTheDatabase() { - if (!$this->config_array['mysqlConnect']) { - $this->message('Database Analyser','Your database connection failed'," - Please go to the 'Basic Configuration' section and correct this problem first. - ",2); + function checkTheDatabase() { + $this->javascript[] = ''; + if (!$this->config_array['mysqlConnect']) { + $this->message('Database Analyser', 'Your database connection failed', ' +

+ Please go to the \'Basic Configuration\' section and correct + this problem first. +

+ ', 2); $this->output($this->outputWrapper($this->printAll())); return; } - if ($this->config_array['no_database']) { - $this->message('Database Analyser','No database selected'," - Please go to the 'Basic Configuration' section and correct this problem first. - ",2); + if ($this->config_array['no_database']) { + $this->message('Database Analyser', 'No database selected', ' +

+ Please go to the \'Basic Configuration\' section and correct + this problem first. +

+ ', 2); $this->output($this->outputWrapper($this->printAll())); return; } @@ -3399,32 +5483,48 @@ // Getting number of static_template records - if ($whichTables['static_template']) { + if ($whichTables['static_template']) { $static_template_count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'static_template'); } $static_template_count=intval($static_template_count); $headCode ='Database Analyser'; - $this->message($headCode,'What is it?'," - In this section you can get an overview of your currently selected database compared to sql-files. You can also import sql-data directly into the database or upgrade tables from earlier versions of TYPO3. - ",0); + $this->message($headCode, 'What is it?', ' +

+ In this section you can get an overview of your currently + selected database compared to sql-files. You can also import + sql-data directly into the database or upgrade tables from + earlier versions of TYPO3. +

+ ', 0); - $cInfo=' - Username: '.TYPO3_db_username.' - Host: '.TYPO3_db_host.' - '; - $this->message($headCode, 'Connected to SQL database successfully'," - ".trim($cInfo)." - ",-1,1); - $this->message($headCode, 'Database'," - ".TYPO3_db.' is selected as database. - Has '.count($whichTables)." tables. - ",-1,1); + $this->message($headCode, 'Connected to SQL database successfully', ' +
+
+ Username: +
+
+ ' . TYPO3_db_username . ' +
+
+ Host: +
+
+ ' . TYPO3_db_host . ' +
+
+ ', -1, 1); + $this->message($headCode, 'Database', ' +

+ ' . TYPO3_db . ' is selected as database. +
+ Has ' . count($whichTables) . ' tables. +

+ ', -1, 1); + // Menu - $this->messageFunc_nl2br = 0; - $sql_files = array_merge( t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1), array() @@ -3432,117 +5532,157 @@ $action_type = $this->INSTALL['database_type']; $actionParts = explode('|',$action_type); - if (count($actionParts)<2) { + if (count($actionParts)<2) { $action_type=''; } - $out=''; - $out.=' - '.$this->fw('Update required tables').' - ' . $this->fw('COMPARE') . ' - '.$this->fw(' ').' - '.$this->fw(' ').' - '; + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'CheckTheDatabaseMenu.html'); + // Get the template part from the file + $menu = $this->contentObject->getSubpart($templateFile, '###MENU###'); - $out.=' - '.$this->fw('Dump static data').' - '.$this->fw(' ').' - ' . $this->fw('IMPORT') . ' - '.$this->fw(' ').' - '; + $menuMarkers = array( + 'action' => $this->action, + 'updateRequiredTables' => 'Update required tables', + 'compare' => 'COMPARE', + 'noticeCmpFileCurrent' => ($action_type == 'cmpFile|CURRENT_TABLES' ? ' class="notice"' : ''), + 'dumpStaticData' => 'Dump static data', + 'import' => 'IMPORT', + 'noticeImportCurrent' => ($action_type == 'import|CURRENT_STATIC' ? ' class="notice"' : ''), + 'noticeCmpTca' => ($action_type == "cmpTCA|" ? ' class="notice"' : ''), + 'compareWithTca' => 'Compare with $TCA', + 'noticeAdminUser' => ($action_type == "adminUser|" ? ' class="notice"' : ''), + 'createAdminUser' => 'Create "admin" user', + 'noticeUc' => ($action_type == "UC|" ? ' class="notice"' : ''), + 'resetUserPreferences' => 'Reset user preferences', + 'noticeCache' => ($action_type == "cache|" ? ' class="notice"' : ''), + 'clearTables' => 'Clear tables' + ); + // Get the subpart for extra SQL + $extraSql = $this->contentObject->getSubpart($menu, '###EXTRASQL###'); - $out.=' -   - '; - - - reset($sql_files); $directJump=''; - while(list($k,$file)=each($sql_files)) { - if ($this->mode=="123" && !count($whichTables) && strstr($file,'_testsite')) { + $extraSqlFiles = array(); + foreach ($sql_files as $k => $file) { + if ($this->mode=="123" && !count($whichTables) && strstr($file,'_testsite')) { $directJump = $this->action.'&TYPO3_INSTALL[database_type]=import|'.rawurlencode($file); } $lf=t3lib_div::testInt($k); $fShortName = substr($file,strlen(PATH_site)); $spec1 = $spec2 = ''; - - $out.=' - '.$this->fw($fShortName.' ('.t3lib_div::formatSize(filesize($file)).')').' - ' . $this->fw('COMPARE') . ' - ' . $this->fw('IMPORT' . $spec1 . $spec2 . '') . ' - ' . $this->fw('VIEW' . $spec1 . $spec2 . '') . ' - '; + // Define the markers content + $extraSqlMarkers = array( + 'fileShortName' => $fShortName, + 'fileSize' => t3lib_div::formatSize(filesize($file)), + 'noticeCmpFile' => ($action_type == 'cmpFile|' . $file ? ' class="notice"' : ''), + 'file' => rawurlencode($file), + 'noticeImport' => ($action_type == 'import|' . $file ? ' class="notice"' : ''), + 'specs' => $spec1 . $spec2, + 'noticeView' => ($action_type == 'view|' . $file ? ' class="notice"' : ''), + 'view' => 'VIEW' + ); + // Fill the markers in the subpart + $extraSqlFiles[] = $this->contentObject->substituteMarkerArray( + $extraSql, + $extraSqlMarkers, + '###|###', + 1, + 0 + ); } - // TCA - $out.=' - - ' . $this->fw('Compare with $TCA') . ' - '; - $out.=' - - ' . $this->fw('Create "admin" user') . ' - '; - $out.=' - - ' . $this->fw('Reset user preferences') . ' - '; - $out.=' - - ' . $this->fw('Clear tables') . ' - '; + // Substitute the subpart for extra SQL + $menu = $this->contentObject->substituteSubpart( + $menu, + '###EXTRASQL###', + implode(chr(10), $extraSqlFiles) + ); + // Fill the markers + $menu = $this->contentObject->substituteMarkerArray( + $menu, + $menuMarkers, + '###|###', + 1, + 1 + ); - $theForm=''.$out.'
'; - $theForm.=''; - - if ($directJump) { - if (!$action_type) { - $this->message($headCode, 'Menu',' - ',0,1); + if ($directJump) { + if (!$action_type) { + $this->message($headCode, 'Menu', ' + ', + 0, 1); } } else { - $this->message($headCode, 'Menu'," - From this menu you can select which of the available SQL files you want to either compare or import/merge with the existing database.

- COMPARE: Compares the tables and fields of the current database and the selected file. It also offers to 'update' the difference found.
- IMPORT: Imports the SQL-dump file into the current database. You can either dump the raw file or choose which tables to import. In any case, you'll see a new screen where you must confirm the operation.
- VIEW: Shows the content of the SQL-file, limiting characters on a single line to a reader-friendly amount.

- The SQL-files are selected from typo3conf/ (here you can put your own) and t3lib/stddb/ (TYPO3 distribution). The SQL-files should be made by the mysqldump tool or at least be formatted like that tool would do. -
-
- ".$theForm." - ",0,1); + $this->message($headCode, 'Menu', ' +

+ From this menu you can select which of the available SQL + files you want to either compare or import/merge with the + existing database. +

+
+
+ COMPARE: +
+
+ Compares the tables and fields of the current database + and the selected file. It also offers to \'update\' the + difference found. +
+
+ IMPORT: +
+
+ Imports the SQL-dump file into the current database. You + can either dump the raw file or choose which tables to + import. In any case, you\'ll see a new screen where you + must confirm the operation. +
+
+ VIEW: +
+
+ Shows the content of the SQL-file, limiting characters + on a single line to a reader-friendly amount. +
+
+

+ The SQL-files are selected from typo3conf/ (here you can put + your own) and t3lib/stddb/ (TYPO3 distribution). The + SQL-files should be made by the mysqldump tool or + at least be formatted like that tool would do. +

+ ' . $menu, 0, 1); } - - if ($action_type) { - switch($actionParts[0]) { + if ($action_type) { + switch($actionParts[0]) { case 'cmpFile': $tblFileContent=''; if (!strcmp($actionParts[1],'CURRENT_TABLES')) { $tblFileContent = t3lib_div::getUrl(PATH_t3lib.'stddb/tables.sql'); foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $loadedExtConf) { - if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql']) { + if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql']) { $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables.sql']); } } - } elseif (@is_file($actionParts[1])) { + } elseif (@is_file($actionParts[1])) { $tblFileContent = t3lib_div::getUrl($actionParts[1]); } - if ($tblFileContent) { + if ($tblFileContent) { $fileContent = implode( chr(10), $this->getStatementArray($tblFileContent,1,'^CREATE TABLE ') ); $FDfile = $this->getFieldDefinitions_fileContent($fileContent); - if (!count($FDfile)) { + if (!count($FDfile)) { die ("Error: There were no 'CREATE TABLE' definitions in the provided file"); } // Updating database... - if (is_array($this->INSTALL['database_update'])) { + if (is_array($this->INSTALL['database_update'])) { $FDdb = $this->getFieldDefinitions_database(); $diff = $this->getDatabaseExtra($FDfile, $FDdb); $update_statements = $this->getUpdateSuggestions($diff); @@ -3572,18 +5712,27 @@ $tLabel = 'Update database tables and fields'; - if ($remove_statements || $update_statements) { + if ($remove_statements || $update_statements) { $formContent = $this->generateUpdateDatabaseForm('get_form',$update_statements,$remove_statements,$action_type); - $this->message($tLabel,'Table and field definitions should be updated'," - There seems to be a number of differencies between the database and the selected SQL-file. - Please select which statements you want to execute in order to update your database:

- ".$formContent." - ",2); + $this->message($tLabel, 'Table and field definitions should be updated', ' +

+ There seems to be a number of differencies + between the database and the selected + SQL-file. +
+ Please select which statements you want to + execute in order to update your database: +

+ ' . $formContent, 2); } else { $formContent = $this->generateUpdateDatabaseForm('get_form',$update_statements,$remove_statements,$action_type); - $this->message($tLabel,'Table and field definitions are OK.'," - The tables and fields in the current database corresponds perfectly to the database in the selected SQL-file. - ",-1); + $this->message($tLabel, 'Table and field definitions are OK.', ' +

+ The tables and fields in the current + database corresponds perfectly to the + database in the selected SQL-file. +

+ ', -1); } } break; @@ -3594,16 +5743,25 @@ // Displaying configured fields which are not in the database $tLabel='Tables and fields in $TCA, but not in database'; $cmpTCA_DB = $this->compareTCAandDatabase($GLOBALS['TCA'],$FDdb); - if (!count($cmpTCA_DB['extra'])) { - $this->message($tLabel,'Table and field definitions OK',' - All fields and tables configured in $TCA appeared to exist in the database as well - ',-1); + if (!count($cmpTCA_DB['extra'])) { + $this->message($tLabel, 'Table and field definitions OK', ' +

+ All fields and tables configured in $TCA + appeared to exist in the database as well +

+ ', -1); } else { - $this->message($tLabel,'Invalid table and field definitions in $TCA!',' - There are some tables and/or fields configured in the $TCA array which do not exist in the database! - This will most likely cause you trouble with the TYPO3 backend interface! - ',3); - while(list($tableName, $conf)=each($cmpTCA_DB['extra'])) { + $this->message($tLabel, 'Invalid table and field definitions in $TCA!', ' +

+ There are some tables and/or fields configured + in the $TCA array which do not exist in the + database! +
+ This will most likely cause you trouble with the + TYPO3 backend interface! +

+ ', 3); + foreach ($cmpTCA_DB['extra'] as $tableName => $conf) { $this->message($tLabel, $tableName,$this->displayFields($conf['fields'],0,'Suggested database field:'),2); } } @@ -3611,7 +5769,7 @@ // Displaying tables that are not setup in $cmpDB_TCA = $this->compareDatabaseAndTCA($FDdb,$GLOBALS['TCA']); $excludeTables='be_sessions,fe_session_data,fe_sessions'; - if (TYPO3_OS=='WIN') {$excludeTables = strtolower($excludeTables);} + if (TYPO3_OS=='WIN') {$excludeTables = strtolower($excludeTables);} $excludeFields = array( 'be_users' => 'uc,lastlogin,usergroup_cached_list', 'fe_users' => 'uc,lastlogin,fe_cruser_id', @@ -3626,55 +5784,89 @@ $tLabel="Tables from database, but not in \$TCA"; $fLabel="Fields from database, but not in \$TCA"; $this->message($tLabel); - if (is_array($cmpDB_TCA['extra'])) { - while(list($tableName, $conf)=each($cmpDB_TCA['extra'])) { + if (is_array($cmpDB_TCA['extra'])) { + foreach ($cmpDB_TCA['extra'] as $tableName => $conf) { if (!t3lib_div::inList($excludeTables,$tableName) && substr($tableName,0,4)!="sys_" && substr($tableName,-3)!="_mm" && substr($tableName,0,6)!="index_" - && substr($tableName,0,6)!='cache_') { - if ($conf['whole_table']) { + && substr($tableName,0,6)!='cache_') { + if ($conf['whole_table']) { $this->message($tLabel, $tableName,$this->displayFields($conf['fields']),1); $tCount++; } else { list($theContent, $fC) = $this->displaySuggestions($conf['fields'],$excludeFields[$tableName]); $fCount+=$fC; - if ($fC) $this->message($fLabel, $tableName,$theContent,1); + if ($fC) { + $this->message($fLabel, $tableName,$theContent,1); + } } } } } - if (!$tCount) { - $this->message($tLabel,'Correct number of tables in the database'," - There are no extra tables in the database compared to the configured tables in the \$TCA array. - ",-1); + if (!$tCount) { + $this->message($tLabel, 'Correct number of tables in the database', ' +

+ There are no extra tables in the database + compared to the configured tables in the $TCA + array. +

+ ', -1); } else { - $this->message($tLabel,'Extra tables in the database'," - There are some tables in the database which are not configured in the \$TCA array. - You should probably not worry about this, but please make sure that you know what these tables are about and why they are not configured in \$TCA. - ",2); + $this->message($tLabel, 'Extra tables in the database', ' +

+ There are some tables in the database which are + not configured in the $TCA array. +
+ You should probably not worry about this, but + please make sure that you know what these tables + are about and why they are not configured in + $TCA. +

+ ', 2); } - if (!$fCount) { - $this->message($fLabel,'Correct number of fields in the database'," - There are no additional fields in the database tables compared to the configured fields in the \$TCA array. - ",-1); + if (!$fCount) { + $this->message($fLabel, 'Correct number of fields in the database', ' +

+ There are no additional fields in the database + tables compared to the configured fields in the + $TCA array. +

+ ', -1); } else { - $this->message($fLabel,'Extra fields in the database'," - There are some additional fields the database tables which are not configured in the \$TCA array. - You should probably not worry about this, but please make sure that you know what these fields are about and why they are not configured in \$TCA. - ",2); + $this->message($fLabel, 'Extra fields in the database', ' +

+ There are some additional fields the database + tables which are not configured in the $TCA + array. +
+ You should probably not worry about this, but + please make sure that you know what these fields + are about and why they are not configured in + $TCA. +

+ ', 2); } // Displaying actual and suggested field database defitions - if (is_array($cmpTCA_DB['matching'])) { + if (is_array($cmpTCA_DB['matching'])) { $tLabel="Comparison between database and \$TCA"; - $this->message($tLabel,'Actual and suggested field definitions'," - This table shows you the suggested field definitions which are calculated based on the configuration in \$TCA. - If the suggested value differs from the actual current database value, you should not panic, but simply check if the datatype of that field is sufficient compared to the data, you want TYPO3 to put there. - ",0); - while(list($tableName, $conf)=each($cmpTCA_DB['matching'])) { + $this->message($tLabel, 'Actual and suggested field definitions', ' +

+ This table shows you the suggested field + definitions which are calculated based on the + configuration in $TCA. +
+ If the suggested value differs from the actual + current database value, you should not panic, + but simply check if the datatype of that field + is sufficient compared to the data, you want + TYPO3 to put there. +

+ ', 0); + foreach ($cmpTCA_DB['matching'] as $tableName => $conf) { $this->message($tLabel, $tableName,$this->displayFieldComp($conf['fields'], $FDdb[$tableName]['fields']),1); } } @@ -3682,44 +5874,44 @@ case 'import': $mode123Imported=0; $tblFileContent=''; - if (preg_match('/^CURRENT_/', $actionParts[1])) { - if (!strcmp($actionParts[1],'CURRENT_TABLES') || !strcmp($actionParts[1],'CURRENT_TABLES+STATIC')) { + if (preg_match('/^CURRENT_/', $actionParts[1])) { + if (!strcmp($actionParts[1],'CURRENT_TABLES') || !strcmp($actionParts[1],'CURRENT_TABLES+STATIC')) { $tblFileContent = t3lib_div::getUrl(PATH_t3lib.'stddb/tables.sql'); - reset($GLOBALS['TYPO3_LOADED_EXT']); - while(list(,$loadedExtConf)=each($GLOBALS['TYPO3_LOADED_EXT'])) { - if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql']) { + foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $loadedExtConf) { + if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql']) { $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables.sql']); } } } - if (!strcmp($actionParts[1],'CURRENT_STATIC') || !strcmp($actionParts[1],'CURRENT_TABLES+STATIC')) { - reset($GLOBALS['TYPO3_LOADED_EXT']); - while(list(,$loadedExtConf)=each($GLOBALS['TYPO3_LOADED_EXT'])) { - if (is_array($loadedExtConf) && $loadedExtConf['ext_tables_static+adt.sql']) { + if (!strcmp($actionParts[1],'CURRENT_STATIC') || !strcmp($actionParts[1],'CURRENT_TABLES+STATIC')) { + foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $loadedExtConf) { + if (is_array($loadedExtConf) && $loadedExtConf['ext_tables_static+adt.sql']) { $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables_static+adt.sql']); } } } - } elseif (@is_file($actionParts[1])) { + } elseif (@is_file($actionParts[1])) { $tblFileContent = t3lib_div::getUrl($actionParts[1]); } - if ($tblFileContent) { + if ($tblFileContent) { $tLabel='Import SQL dump'; // Getting statement array from $statements = $this->getStatementArray($tblFileContent,1); list($statements_table, $insertCount) = $this->getCreateTables($statements,1); // Updating database... - if ($this->INSTALL['database_import_all']) { + if ($this->INSTALL['database_import_all']) { $r=0; - foreach ($statements as $k=>$v) { + foreach ($statements as $k=>$v) { $res = $GLOBALS['TYPO3_DB']->admin_query($v); $r++; } - // Make a database comparison because some tables that are defined twice have not been created at this point. This applies to the "pages.*" fields defined in sysext/cms/ext_tables.sql for example. + // Make a database comparison because some tables that are defined twice have + // not been created at this point. This applies to the "pages.*" + // fields defined in sysext/cms/ext_tables.sql for example. $fileContent = implode( $this->getStatementArray($tblFileContent,1,'^CREATE TABLE '), chr(10) @@ -3728,13 +5920,13 @@ $FDdb = $this->getFieldDefinitions_database(); $diff = $this->getDatabaseExtra($FDfile, $FDdb); $update_statements = $this->getUpdateSuggestions($diff); - if (is_array($update_statements['add'])) { - foreach ($update_statements['add'] as $statement) { + if (is_array($update_statements['add'])) { + foreach ($update_statements['add'] as $statement) { $res = $GLOBALS['TYPO3_DB']->admin_query($statement); } } - if ($this->mode=='123') { + if ($this->mode=='123') { // Create default be_user admin/password $username = 'admin'; $pass = 'password'; @@ -3759,77 +5951,157 @@ } } - $this->message($tLabel,'Imported ALL'," - Queries: ".$r." - ",1,1); - if (t3lib_div::_GP('goto_step')) { + $this->message($tLabel, 'Imported ALL', ' +

+ Queries: ' . $r . ' +

+ ', 1, 1); + if (t3lib_div::_GP('goto_step')) { $this->action.='&step='.t3lib_div::_GP('goto_step'); t3lib_utility_Http::redirect($this->action); } - } elseif (is_array($this->INSTALL['database_import'])) { + } elseif (is_array($this->INSTALL['database_import'])) { // Traverse the tables - reset($this->INSTALL['database_import']); - while(list($table,$md5str)=each($this->INSTALL['database_import'])) { - if ($md5str==md5($statements_table[$table])) { + foreach ($this->INSTALL['database_import'] as $table => $md5str) { + if ($md5str==md5($statements_table[$table])) { $res = $GLOBALS['TYPO3_DB']->admin_query('DROP TABLE IF EXISTS '.$table); $res = $GLOBALS['TYPO3_DB']->admin_query($statements_table[$table]); - if ($insertCount[$table]) { + if ($insertCount[$table]) { $statements_insert = $this->getTableInsertStatements($statements, $table); - reset($statements_insert); - while(list($k,$v)=each($statements_insert)) { + foreach ($statements_insert as $k => $v) { $res = $GLOBALS['TYPO3_DB']->admin_query($v); } } - $this->message($tLabel,"Imported '".$table."'"," - Rows: ".$insertCount[$table]." - ",1,1); + $this->message($tLabel, 'Imported \'' . $table . '\'', ' +

+ Rows: ' . $insertCount[$table] . ' +

+ ', 1, 1); } } } $mode123Imported=$this->isBasicComplete($tLabel); - if (!$mode123Imported) { + if (!$mode123Imported) { // Re-Getting current tables - may have been changed during import $whichTables=$this->getListOfTables(); - if (count($statements_table)) { + if (count($statements_table)) { reset($statements_table); $out=''; - while(list($table,$definition)=each($statements_table)) { - $exist=isset($whichTables[$table]); - $out.=' - - - - '.$this->fw($insertCount[$table]?"Rows: ".$insertCount[$table]:"").' - - '.($exist?''.$this->fw('Table exists!'):'').' - '; - } + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'CheckTheDatabaseImport.html'); + // Get the template part from the file + $content = $this->contentObject->getSubpart($templateFile, '###IMPORT###'); - $content =''; - if ($this->mode!='123') { - $content.=''.$out.'
-
- '; + if ($this->mode!='123') { + $tables = array(); + // Get the subpart for regular mode + $regularModeSubpart = $this->contentObject->getSubpart($content, '###REGULARMODE###'); + foreach ($statements_table as $table => $definition) { + // Get the subpart for rows + $tableSubpart = $this->contentObject->getSubpart($content, '###ROWS###'); + // Fill the 'table exists' part when it exists + $exist=isset($whichTables[$table]); + if ($exist) { + // Get the subpart for table exists + $existSubpart = $this->contentObject->getSubpart($tableSubpart, '###EXIST###'); + // Define the markers content + $existMarkers = array ( + 'tableExists' => 'Table exists!', + 'backPath' => $this->backPath + ); + // Fill the markers in the subpart + $existSubpart = $this->contentObject->substituteMarkerArray( + $existSubpart, + $existMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for table exists + $tableHtml = $this->contentObject->substituteSubpart( + $tableSubpart, + '###EXIST###', + $existSubpart + ); + // Define the markers content + $tableMarkers = array ( + 'table' => $table, + 'definition' => md5($definition), + 'count' => $insertCount[$table] ? $insertCount[$table] : '', + 'rowLabel' => $insertCount[$table] ? 'Rows: ' : '', + 'tableExists' => 'Table exists!', + 'backPath' => $this->backPath + ); + // Fill the markers + $tables[] = $this->contentObject->substituteMarkerArray( + $tableHtml, + $tableMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for the rows + $regularModeSubpart = $this->contentObject->substituteSubpart( + $regularModeSubpart, + '###ROWS###', + implode(chr(10), $tables) + ); } - $content.='mode=="123"||t3lib_div::_GP('presetWholeTable')?' checked="checked"':'').'>
+ // Substitute the subpart for the regular mode + $content = $this->contentObject->substituteSubpart( + $content, + '###REGULARMODE###', + $regularModeSubpart + ); + // Define the markers content + $contentMarkers = array( + 'checked' => ($this->mode == '123' || t3lib_div::_GP('presetWholeTable') ? 'checked="checked"' : ''), + 'label' => 'Import the whole file \'' . basename($actionParts[1]) . '\' directly (ignores selections above)' + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $content, + $contentMarkers, + '###|###', + 1, + 1 + ); - '; $form = $this->getUpdateDbFormWrap($action_type, $content); - $this->message($tLabel,'Select tables to import'," - This is an overview of the CREATE TABLE definitions in the SQL file. - Select which tables you want to dump to the database. - Any table you choose dump to the database is dropped from the database first, so you'll lose all data in existing tables. - ".$form,1,1); + $this->message($tLabel, 'Select tables to import', ' +

+ This is an overview of the CREATE TABLE + definitions in the SQL file. +
+ Select which tables you want to dump to + the database. +
+ Any table you choose dump to the + database is dropped from the database + first, so you\'ll lose all data in + existing tables. +

+ ' . $form, 1, 1); } else { - $this->message($tLabel,'No tables'," - There seems to be no CREATE TABLE definitions in the SQL file. - This tool is intelligently creating one table at a time and not just dumping the whole content of the file uncritically. That's why there must be defined tables in the SQL file. - ",3,1); + $this->message($tLabel, 'No tables', ' +

+ There seems to be no CREATE TABLE + definitions in the SQL file. +
+ This tool is intelligently creating one + table at a time and not just dumping the + whole content of the file uncritically. + That\'s why there must be defined tables + in the SQL file. +

+ ', 3, 1); } } } @@ -3843,101 +6115,178 @@ $maxL = 1000; $strLen = strlen($fileContent); $maxlen = 200+($maxL-t3lib_div::intInRange(($strLen-20000)/100,0,$maxL)); - if (count($statements)) { + if (count($statements)) { $out = ''; foreach ($statements as $statement) { - $out.= nl2br(htmlspecialchars(t3lib_div::fixed_lgd_cs($statement,$maxlen)).chr(10).chr(10)); + $out.= '

' . nl2br(htmlspecialchars(t3lib_div::fixed_lgd_cs($statement,$maxlen))) . '

'; } } $this->message($tLabel,'Content of '.basename($actionParts[1]),$out,1); } break; - case 'adminUser': // Create admin user - if ($whichTables['be_users']) { - if (is_array($this->INSTALL['database_adminUser'])) { + // Create admin user + case 'adminUser': + if ($whichTables['be_users']) { + if (is_array($this->INSTALL['database_adminUser'])) { $username = preg_replace('/[^\da-z._-]/i', '', trim($this->INSTALL['database_adminUser']['username'])); $pass = trim($this->INSTALL['database_adminUser']['password']); $pass2 = trim($this->INSTALL['database_adminUser']['password2']); - if ($username && $pass && $pass2) { + if ($username && $pass && $pass2) { if ($pass != $pass2) { $this->message($headCode, 'Passwords are not equal!', ' - The passwords entered twice are not equal.',2,1); +

+ The passwords entered twice are not + equal. +

+ ', 2, 1); } else { - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'be_users', 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr($username, 'be_users')); - if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) { + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'be_users', 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr($username, 'be_users')); + if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) { - $insertFields = array( - 'username' => $username, - 'password' => md5($pass), - 'admin' => 1, - 'uc' => '', - 'fileoper_perms' => 0, - 'tstamp' => $GLOBALS['EXEC_TIME'], - 'crdate' => $GLOBALS['EXEC_TIME'] - ); + $insertFields = array( + 'username' => $username, + 'password' => md5($pass), + 'admin' => 1, + 'uc' => '', + 'fileoper_perms' => 0, + 'tstamp' => $GLOBALS['EXEC_TIME'], + 'crdate' => $GLOBALS['EXEC_TIME'] + ); - $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('be_users', $insertFields); + $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('be_users', $insertFields); - $this->isBasicComplete($headCode); + $this->isBasicComplete($headCode); - if ($result) { - $this->message($headCode,'User created',' - Username: '.htmlspecialchars($username).'
', - 1,1); + if ($result) { + $this->message($headCode, 'User created', ' +

+ Username: + ' . + htmlspecialchars($username) . ' + +

+ ', 1, 1); + } else { + $this->message($headCode, 'User not created', ' +

+ Error: + ' . + htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error()) . ' + +

+ ', 3, 1); + } } else { - $this->message($headCode,'User not created',' - Error: '.htmlspecialchars($GLOBALS['TYPO3_DB']->sql_error()).'
', - 3,1); + $this->message($headCode, 'Username not unique!', ' +

+ The username, + ' . + htmlspecialchars($username) . ' + + , was not unique. +

+ ', 2, 1); } - } else { - $this->message($headCode,'Username not unique!',' - The username, '.htmlspecialchars($username).', was not unique.',2,1); } + } else { + $this->message($headCode, 'Missing data!', ' +

+ Not all required form fields have been + filled. +

+ ', 2, 1); } - } else { - $this->message($headCode,'Missing data!',' - Not all required form fields have been filled.',2,1); } - } - $content = ' - username - unique, no space, lowercase
- password - password (repeated) - '; + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'CheckTheDatabaseAdminUser.html'); + // Get the template part from the file + $content = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Define the markers content + $contentMarkers = array( + 'userName' => 'username - unique, no space, lowercase', + 'password' => 'password', + 'repeatPassword' => 'password (repeated)' + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $content, + $contentMarkers, + '###|###', + 1, + 1 + ); $form = $this->getUpdateDbFormWrap($action_type, $content); - $this->message($headCode,'Create admin user'," - Enter username and password for a new admin user.
- You should use this function only if there are no admin users in the database, for instance if this is a blank database.
- After you've created the user, log in and add the rest of the user information, like email and real name.
-
- ".$form." - ",0,1); + $this->message($headCode, 'Create admin user', ' +

+ Enter username and password for a new admin + user. +
+ You should use this function only if there are + no admin users in the database, for instance if + this is a blank database. +
+ After you\'ve created the user, log in and add + the rest of the user information, like email and + real name. +

+ ' . $form, 0, 1); } else { - $this->message($headCode,'Required table not in database'," - 'be_users' must be a table in the database! - ",3,1); + $this->message($headCode, 'Required table not in database', ' +

+ \'be_users\' must be a table in the database! +

+ ', 3, 1); } break; - case 'UC': // clear uc - if ($whichTables['be_users']) { - if (!strcmp($this->INSTALL['database_UC'],1)) { + // clear uc + case 'UC': + if ($whichTables['be_users']) { + if (!strcmp($this->INSTALL['database_UC'],1)) { $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_users', '', array('uc' => '')); - $this->message($headCode,'Clearing be_users.uc','Done.',1); + $this->message($headCode, 'Clearing be_users.uc', ' +

+ Done. +

+ ', 1); } - $content = ' - - '; + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'CheckTheDatabaseUc.html'); + // Get the template part from the file + $content = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Define the markers content + $contentMarkers = array( + 'clearBeUsers' => 'Clear be_users preferences ("uc" field)' + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $content, + $contentMarkers, + '###|###', + 1, + 1 + ); + $form = $this->getUpdateDbFormWrap($action_type, $content); - $this->message($headCode,'Clear user preferences'," - If you press this button all backend users from the tables be_users will have their user preferences cleared (field 'uc' set to an empty string).
- This may come in handy in rare cases where that configuration may be corrupt.
- Clearing this will clear all user settings from the 'Setup' module.
-
- ".$form); + $this->message($headCode, 'Clear user preferences', ' +

+ If you press this button all backend users from + the tables be_users will have their user + preferences cleared (field \'uc\' set to an + empty string). +
+ This may come in handy in rare cases where that + configuration may be corrupt. +
+ Clearing this will clear all user settings from + the \'Setup\' module. +

+ ' . $form); } else { - $this->message($headCode,'Required table not in database'," - 'be_users' must be a table in the database! - ",3); + $this->message($headCode, 'Required table not in database', ' +

+ \'be_users\' must be a table in the database! +

+ ', 3); } break; case 'cache': @@ -3948,23 +6297,47 @@ (t3lib_extMgm::isLoaded('sys_stat') ? ',--div--,sys_stat' : '') ); - if (is_array($this->INSTALL['database_clearcache'])) { - $qList=array(); - reset($tableListArr); - while(list(,$table)=each($tableListArr)) { - if ($table!='--div--') { + if (is_array($this->INSTALL['database_clearcache'])) { + $qList = array(); + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'CheckTheDatabaseCache.html'); + // Get the subpart for emptied tables + $emptiedTablesSubpart = $this->contentObject->getSubpart($templateFile, '###EMPTIEDTABLES###'); + // Get the subpart for table + $tableSubpart = $this->contentObject->getSubpart($emptiedTablesSubpart, '###TABLE###'); + foreach ($tableListArr as $table) { + if ($table!='--div--') { $table_c = TYPO3_OS=='WIN' ? strtolower($table) : $table; - if ($this->INSTALL['database_clearcache'][$table] && $whichTables[$table_c]) { + if ($this->INSTALL['database_clearcache'][$table] && $whichTables[$table_c]) { $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, ''); - $qList[] = $table; + // Define the markers content + $emptiedTablesMarkers = array( + 'tableName' => $table + ); + // Fill the markers in the subpart + $qList[] = $this->contentObject->substituteMarkerArray( + $tableSubpart, + $emptiedTablesMarkers, + '###|###', + 1, + 1 + ); } } } - if (count($qList)) { - $this->message($headCode,'Clearing cache',' - The following tables were emptied:

- '.implode($qList,'
') - ,1); + // Substitute the subpart for table + $emptiedTablesSubpart = $this->contentObject->substituteSubpart( + $emptiedTablesSubpart, + '###TABLE###', + implode(chr(10), $qList) + ); + + if (count($qList)) { + $this->message($headCode, 'Clearing cache', ' +

+ The following tables were emptied: +

+ ' . $emptiedTablesSubpart, 1); } } // Count entries and make checkboxes @@ -3987,27 +6360,71 @@ $checkBoxes=array(); $countEntries=array(); reset($tableListArr); - while(list(,$table)=each($tableListArr)) { - if ($table!='--div--') { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'CheckTheDatabaseCache.html'); + // Get the subpart for table list + $tableListSubpart = $this->contentObject->getSubpart($templateFile, '###TABLELIST###'); + // Get the subpart for the group separator + $groupSubpart = $this->contentObject->getSubpart($tableListSubpart, '###GROUP###'); + // Get the subpart for a single table + $singleTableSubpart = $this->contentObject->getSubpart($tableListSubpart, '###SINGLETABLE###'); + $group = array(); + $checkBoxes = array(); + foreach ($tableListArr as $table) { + if ($table!='--div--') { $table_c = TYPO3_OS=='WIN' ? strtolower($table) : $table; - if ($whichTables[$table_c]) { + if ($whichTables[$table_c]) { $countEntries[$table] = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $table); // Checkboxes: - $checkBoxes[]= 'INSTALL['database_clearcache'][$table]||$_GET['PRESET']['database_clearcache'][$table]?' checked="checked"':'').'> '; + if ( + $this->INSTALL['database_clearcache'][$table] || + $_GET['PRESET']['database_clearcache'][$table] + ) { + $checked = 'checked="checked"'; + } else { + $checked = ''; + } + // Define the markers content + $singleTableMarkers = array( + 'table' => $table, + 'checked' => $checked, + 'count' => '(' . $countEntries[$table] . ' rows)', + 'label' => $labelArr[$table] + + ); + // Fill the markers in the subpart + $checkBoxes[] = $this->contentObject->substituteMarkerArray( + $singleTableSubpart, + $singleTableMarkers, + '###|###', + 1, + 1 + ); } } else { - $checkBoxes[]= '
'; + $checkBoxes[] = $groupSubpart; } } + // Substitute the subpart for the single tables + $content = $this->contentObject->substituteSubpart( + $tableListSubpart, + '###SINGLETABLE###', + implode(chr(10), $checkBoxes) + ); + // Substitute the subpart for the group separator + $content = $this->contentObject->substituteSubpart( + $content, + '###GROUP###', + '' + ); - $content = implode('
',$checkBoxes).'

'; - $form = $this->getUpdateDbFormWrap($action_type, $content); - $this->message($headCode,'Clear out selected tables',' - Pressing this button will delete all records from the selected tables.
-
- '.$form.' - '); + $this->message($headCode, 'Clear out selected tables', ' +

+ Pressing this button will delete all records from + the selected tables. +

+ ' . $form); break; } } @@ -4016,11 +6433,11 @@ } /** - * Generates update wizard, outputs it as well + * Generates update wizard * - * @return void + * @return void */ - function updateWizard() { + function updateWizard() { global $TYPO3_CONF_VARS; // clear cache files @@ -4029,12 +6446,12 @@ // generate new cache files and include them $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'] = 1; $TYPO3_LOADED_EXT = t3lib_extMgm::typo3_loadExtensions(); - if ($TYPO3_LOADED_EXT['_CACHEFILE']) { - require(PATH_typo3conf.$TYPO3_LOADED_EXT['_CACHEFILE'].'_ext_localconf.php'); + if ($TYPO3_LOADED_EXT['_CACHEFILE']) { + require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php'); } // call wizard - $action = ($this->INSTALL['database_type']?$this->INSTALL['database_type']:'checkForUpdate'); + $action = ($this->INSTALL['database_type'] ? $this->INSTALL['database_type'] : 'checkForUpdate'); $this->updateWizard_parts($action); $this->output($this->outputWrapper($this->printAll())); } @@ -4042,131 +6459,331 @@ /** * Implements the steps for the update wizard * - * @param string action which should be done. - * @return void + * @param string $action Which should be done. + * @return void */ - function updateWizard_parts($action) { + function updateWizard_parts($action) { $content = ''; - switch ($action) { - case 'checkForUpdate': // first step - check for updates available + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'UpdateWizardParts.html'); + + switch ($action) { + // first step - check for updates available + case 'checkForUpdate': + // Get the subpart for check for update + $checkForUpdateSubpart = $this->contentObject->getSubpart($templateFile, '###CHECKFORUPDATE###'); $title = 'Step 1 - Introduction'; $updateWizardBoxes = ''; - if (!$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']) { - $content = 'No updates registered!'; - break; - } + if (!$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']) { + $updatesAvailableSubpart = ' +

+ + No updates registered! + +

+ '; + } else { - // step through list of updates, and check if update is needed and if yes, output an explanation - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $identifier => $className) { - $tmpObj = $this->getUpgradeObjInstance($className, $identifier); - if (method_exists($tmpObj,'checkForUpdate')) { - $explanation = ''; - if ($tmpObj->checkForUpdate($explanation)) { - $updateWizardBoxes.= ' -
-

'.$identifier.'

-

'.str_replace(chr(10),'
',$explanation).'

- -
'; + // step through list of updates, and check if update is needed and if yes, output an explanation + $updatesAvailableSubpart = $this->contentObject->getSubpart($checkForUpdateSubpart, '###UPDATESAVAILABLE###'); + $updateWizardBoxesSubpart = $this->contentObject->getSubpart($updatesAvailableSubpart, '###UPDATEWIZARDBOXES###'); + $singleUpdateWizardBoxSubpart = $this->contentObject->getSubpart($updateWizardBoxesSubpart, '###SINGLEUPDATEWIZARDBOX###'); + $singleUpdate = array(); + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $identifier => $className) { + $tmpObj = $this->getUpgradeObjInstance($className, $identifier); + if (method_exists($tmpObj,'checkForUpdate')) { + $explanation = ''; + if ($tmpObj->checkForUpdate($explanation)) { + $updateMarkers = array( + 'identifier' => $identifier, + 'explanation' => $explanation, + 'next' => 'Next' + ); + $singleUpdate[] = $this->contentObject->substituteMarkerArray( + $singleUpdateWizardBoxSubpart, + $updateMarkers, + '###|###', + 1, + 1 + ); + } } } - } - if ($updateWizardBoxes) { - $updateWizardBoxes = '
'.$updateWizardBoxes.'
'; - $content = ' -
- - '.$updateWizardBoxes.'
'; - } else { - $content = 'No updates to perform!'; + if (!empty($singleUpdate)) { + $updateWizardBoxesSubpart = $this->contentObject->substituteSubpart( + $updateWizardBoxesSubpart, + '###SINGLEUPDATEWIZARDBOX###', + implode(chr(10), $singleUpdate) + ); + $updateWizardBoxesMarkers = array( + 'action' => $this->action + ); + $updateWizardBoxesSubpart = $this->contentObject->substituteMarkerArray( + $updateWizardBoxesSubpart, + $updateWizardBoxesMarkers, + '###|###', + 1, + 1 + ); + } else { + $updateWizardBoxesSubpart = ' +

+ + No updates to perform! + +

+ '; + } + $updatesAvailableSubpart = $this->contentObject->substituteSubpart( + $updatesAvailableSubpart, + '###UPDATEWIZARDBOXES###', + $updateWizardBoxesSubpart + ); + $updatesAvailableMarkers = array( + 'finalStep' => 'Final Step', + 'finalStepExplanation' => ' +

+ When all updates are done you should check + your database for required updates. +
+ Perform + + COMPARE DATABASE + + as often until no more changes are required. +
+
+

+ ', + 'compareDatabase' => 'COMPARE DATABASE' + ); + $updatesAvailableSubpart = $this->contentObject->substituteMarkerArray( + $updatesAvailableSubpart, + $updatesAvailableMarkers, + '###|###', + 1, + 1 + ); } - $content .= '
-
-

Final Step

-

When all updates are done you should check your database for required updates.
- Perform COMPARE DATABASE as often until no more changes are required.

- -

-
-
'; + $content = $this->contentObject->substituteSubpart( + $checkForUpdateSubpart, + '###UPDATESAVAILABLE###', + $updatesAvailableSubpart + ); break; - case 'getUserInput': // second step - get user input and ask for final confirmation + // second step - get user input and ask for final confirmation + case 'getUserInput': $title = 'Step 2 - Configuration of updates'; - $formContent = '

The following updates will be performed:

'; - if (!$this->INSTALL['update']) { - $content = 'No updates selected!'; + $getUserInputSubpart = $this->contentObject->getSubpart($templateFile, '###GETUSERINPUT###'); + + $markers = array( + 'introduction' => 'The following updates will be performed:', + 'showDatabaseQueries' => 'Show database queries performed', + 'performUpdates' => 'Perform updates!', + 'action' => $this->action + ); + + if (!$this->INSTALL['update']) { + $noUpdatesAvailableSubpart = $this->contentObject->getSubpart($getUserInputSubpart, '###NOUPDATESAVAILABLE###'); + + $noUpdateMarkers['noUpdates'] = 'No updates selected!'; + + $noUpdatesAvailableSubpart = $this->contentObject->substituteMarkerArray( + $noUpdatesAvailableSubpart, + $noUpdateMarkers, + '###|###', + 1, + 1 + ); break; - } + } else { // update methods might need to get custom data - foreach ($this->INSTALL['update'] as $identifier => $tmp) { - $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$identifier]; + $updatesAvailableSubpart = $this->contentObject->getSubpart($getUserInputSubpart, '###UPDATESAVAILABLE###'); + foreach ($this->INSTALL['update'] as $identifier => $tmp) { + $updateMarkers = array(); - $tmpObj = $this->getUpgradeObjInstance($className, $identifier); + $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$identifier]; - $formContent .= '

'.$identifier.'
'; - if (method_exists($tmpObj,'getUserInput')) { - $formContent .= $tmpObj->getUserInput('TYPO3_INSTALL[update]['.$identifier.']'); + $tmpObj = $this->getUpgradeObjInstance($className, $identifier); + + $updateMarkers['identifier'] = $identifier; + + if (method_exists($tmpObj,'getUserInput')) { + $updateMarkers['identifierMethod'] = $tmpObj->getUserInput('TYPO3_INSTALL[update][' . $identifier . ']'); + } + + $updateItems[] = $this->contentObject->substituteMarkerArray( + $updatesAvailableSubpart, + $updateMarkers, + '###|###', + 1, + 1 + ); } - $formContent.= '

'; + $updatesAvailableSubpart = implode(chr(10), $updateItems); } - $formContent.= '
'; - $content = $this->getUpdateDbFormWrap('performUpdate', $formContent,'Perform updates!'); - break; + + $content = $this->contentObject->substituteSubpart( + $getUserInputSubpart, + '###NOUPDATESAVAILABLE###', + $noUpdatesAvailableSubpart + ); + $content = $this->contentObject->substituteSubpart( + $content, + '###UPDATESAVAILABLE###', + $updatesAvailableSubpart + ); + $content = $this->contentObject->substituteMarkerArray( + $content, + $markers, + '###|###', + 1, + 1 + ); + break; case 'performUpdate': // third step - perform update $title = 'Step 3 - Perform updates'; - if (!$this->INSTALL['update']['extList']) { break; } + $performUpdateSubpart = $this->contentObject->getSubpart($templateFile, '###PERFORMUPDATE###'); + $updateItemsSubpart = $this->contentObject->getSubpart($performUpdateSubpart, '###UPDATEITEMS###'); + $checkUserInputSubpart = $this->contentObject->getSubpart($updateItemsSubpart, '###CHECKUSERINPUT###'); + $updatePerformedSubpart = $this->contentObject->getSubpart($updateItemsSubpart, '###UPDATEPERFORMED###'); + $noPerformUpdateSubpart = $this->contentObject->getSubpart($updateItemsSubpart, '###NOPERFORMUPDATE###'); + $databaseQueriesSubpart = $this->contentObject->getSubpart($updatePerformedSubpart, '###DATABASEQUERIES###'); + $customOutputSubpart = $this->contentObject->getSubpart($updatePerformedSubpart, '###CUSTOMOUTPUT###'); + if (!$this->INSTALL['update']['extList']) { break; } $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = TRUE; - foreach ($this->INSTALL['update']['extList'] as $identifier) { + foreach ($this->INSTALL['update']['extList'] as $identifier) { $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$identifier]; $tmpObj = $this->getUpgradeObjInstance($className, $identifier); - - $content = '

'.$identifier.'

'; + $updateItemsMarkers['identifier'] = $identifier; // check user input if testing method is available - if (method_exists($tmpObj,'checkUserInput')) { + if (method_exists($tmpObj,'checkUserInput') && !$tmpObj->checkUserInput($customOutput)) { $customOutput = ''; - if (!$tmpObj->checkUserInput($customOutput)) { - $content.= ($customOutput?$customOutput:'Something went wrong').'

'; - $content.= 'Go back to update configuration'; - break; - } - } + $userInputMarkers = array( + 'customOutput' => ($customOutput ? $customOutput : 'Something went wrong'), + 'goBack' => 'Go back to update configuration' + ); + $checkUserInput = $this->contentObject->substituteMarkerArray( + $checkUserInputSubpart, + $userInputMarkers, + '###|###', + 1, + 1 + ); + } else { - if (method_exists($tmpObj,'performUpdate')) { - $customOutput = ''; - $dbQueries = array(); - if ($tmpObj->performUpdate($dbQueries, $customOutput)) { - $content .= 'Update successful!'; + if (method_exists($tmpObj,'performUpdate')) { + $customOutput = ''; + $dbQueries = array(); + if ($tmpObj->performUpdate($dbQueries, $customOutput)) { + $performUpdateMarkers['updateStatus'] = 'Update successful!'; + } else { + $performUpdateMarkers['updateStatus'] = 'Update FAILED!'; + } + if ($this->INSTALL['update']['showDatabaseQueries']) { + $content .= '
' . implode('
',$dbQueries); + foreach($dbQueries as $query) { + $databaseQueryMarkers['query'] = $query; + $databaseQueries[] = $this->contentObject->substituteMarkerArray( + $databaseQueriesSubpart, + $databaseQueryMarkers, + '###|###', + 1, + 1 + ); + } + } + + if (strlen($customOutput)) { + $content.= '
' . $customOutput; + $customOutputMarkers['custom'] = $customOutput; + $customOutputItem = $this->contentObject->substituteMarkerArray( + $customOutputSubpart, + $customOutputMarkers, + '###|###', + 1, + 1 + ); + } + + $updatePerformed = $this->contentObject->substituteSubpart( + $updatePerformedSubpart, + '###DATABASEQUERIES###', + implode(chr(10), $databaseQueries) + ); + $updatePerformed = $this->contentObject->substituteSubpart( + $updatePerformed, + '###CUSTOMOUTPUT###', + $customOutputItem + ); + $updatePerformed = $this->contentObject->substituteMarkerArray( + $updatePerformed, + $performUpdateMarkers, + '###|###', + 1, + 1 + ); } else { - $content.= 'Update FAILED!'; + $noPerformUpdateMarkers['noUpdateMethod'] = 'No update method available!'; + $noPerformUpdate = $this->contentObject->substituteMarkerArray( + $noPerformUpdateSubpart, + $noPerformUpdateMarkers, + '###|###', + 1, + 1 + ); } - if ($this->INSTALL['update']['showDatabaseQueries']) { - $content .= '
' . implode('
',$dbQueries); - } - if (strlen($customOutput)) { - $content.= '
' . $customOutput; - } - } else { - $content .= 'No update method available!'; } + $updateItem = $this->contentObject->substituteSubpart( + $updateItemsSubpart, + '###CHECKUSERINPUT###', + $checkUserInput + ); + $updateItem = $this->contentObject->substituteSubpart( + $updateItem, + '###UPDATEPERFORMED###', + $updatePerformed + ); + $updateItem = $this->contentObject->substituteSubpart( + $updateItem, + '###NOPERFORMUPDATE###', + $noPerformUpdate + ); + $updateItem = $this->contentObject->substituteSubpart( + $updateItem, + '###UPDATEITEMS###', + implode(chr(10), $updateItems) + ); + $updateItems[] = $this->contentObject->substituteMarkerArray( + $updateItem, + $updateItemsMarkers, + '###|###', + 1, + 1 + ); } + $content = $this->contentObject->substituteSubpart( + $performUpdateSubpart, + '###UPDATEITEMS###', + implode(chr(10), $updateItems) + ); $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = FALSE; break; } - $this->message('Update Wizard',$title,$content); + $this->message('Update Wizard', $title, $content); } /** * Creates instance of an upgrade object, setting the pObj, versionNumber and pObj * - * @param string class name - * @param identifier identifier of upgrade object - needed to fetch user input - * @return object newly instanciated upgrade object + * @param string $className The class name + * @param string $identifier The identifier of upgrade object - needed to fetch user input + * @return object Newly instanciated upgrade object */ - function getUpgradeObjInstance($className, $identifier) { + function getUpgradeObjInstance($className, $identifier) { $tmpObj = t3lib_div::getUserObj($className); $tmpObj->versionNumber = t3lib_div::int_from_ver(TYPO3_version); $tmpObj->pObj = $this; @@ -4175,41 +6792,42 @@ } /** - * [Describe function...] + * Check if at lease one backend admin user has been created * - * @return [type] ... + * @return integer Amount of backend users in the database */ - function isBackendAdminUser() { + function isBackendAdminUser() { return $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'be_users', 'admin=1'); } /** - * [Describe function...] + * Check if static templates are available in database * - * @return [type] ... + * @return integer Amount of static templates in the database */ - function isStaticTemplates() { + function isStaticTemplates() { return $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'static_template'); } /** - * [Describe function...] + * Check if the basic settings are complete + * Only used by 1-2-3 mode * - * @param [type] $tLabel: ... - * @return [type] ... + * @param string $tLabel The header for the message + * @return boolean TRUE if complete */ - function isBasicComplete($tLabel) { - if ($this->mode=='123') { + function isBasicComplete($tLabel) { + if ($this->mode=='123') { $tables = $this->getListOfTables(); - if (count($tables)) { + if (count($tables)) { $beuser = $this->isBackendAdminUser(); $static = $this->isStaticTemplates(); } - if (count($tables) && $beuser && $static) { + if (count($tables) && $beuser && $static) { $mode123Imported=1; - $this->message($tLabel,'Basic Installation Completed',nl2br($this->messageBasicFinished()),-1,1); - $this->message($tLabel,'Security Risk!',nl2br($this->securityRisk().$this->alterPasswordForm()),2,1); + $this->message($tLabel, 'Basic Installation Completed', $this->messageBasicFinished(), -1, 1); + $this->message($tLabel,'Security Risk!',$this->securityRisk().$this->alterPasswordForm(),2,1); } else { $this->message($tLabel,'Still missing something?',nl2br(' You may be missing one of these points before your TYPO3 installation is complete: @@ -4230,17 +6848,18 @@ } /** - * [Describe function...] + * Generate the contents for the form for 'Database Analyzer' + * when the 'COMPARE' still contains errors * - * @param [type] $type: ... - * @param [type] $arr_update: ... - * @param [type] $arr_remove: ... - * @param [type] $action_type: ... - * @return [type] ... + * @param string $type get_form if the form needs to be generated + * @param array $arr_update The tables/fields which needs an update + * @param array $arr_remove The tables/fields which needs to be removed + * @param string $action_type The action type + * @return string HTML for the form */ - function generateUpdateDatabaseForm($type, $arr_update, $arr_remove, $action_type) { + function generateUpdateDatabaseForm($type, $arr_update, $arr_remove, $action_type) { $content = ''; - switch($type) { + switch($type) { case 'get_form': $content.= $this->generateUpdateDatabaseForm_checkboxes($arr_update['clear_table'],'Clear tables (use with care!)',false,true); @@ -4263,63 +6882,121 @@ } /** - * [Describe function...] + * Form wrap for 'Database Analyzer' + * when the 'COMPARE' still contains errors * - * @param [type] $action_type: ... - * @param [type] $content: ... - * @param [type] $label: ... - * @return [type] ... + * @param string $action_type The action type + * @param string $content The form content + * @param string $label The submit button label + * @return string HTML of the form */ - function getUpdateDbFormWrap($action_type, $content, $label='Write to database') { - $form = '
' . - '' . - $content . '
' . - ''; + function getUpdateDbFormWrap($action_type, $content, $label='Write to database') { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'GetUpdateDbFormWrap.html'); + // Get the template part from the file + $form = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Define the markers content + $formMarkers = array( + 'action' => $this->action, + 'actionType' => htmlspecialchars($action_type), + 'content' => $content, + 'label' => $label + ); + // Fill the markers + $form = $this->contentObject->substituteMarkerArray( + $form, + $formMarkers, + '###|###', + 1, + 1 + ); + return $form; } /** - * [Describe function...] + * Generates an HTML table for the setup of database tables + * Used in 'Database analyzer > Compare with $TCA' * - * @param [type] $arr: ... - * @param [type] $pre: ... - * @param [type] $label: ... - * @return [type] ... + * @param array $arr Description of the table with fieldname and fieldcontent + * @param boolean $pre TRUE if the field content needs to be wrapped with a
 tag
+	 * @param string $label The header label
+	 * @return string HTML of the table
 	 */
-	function displayFields($arr, $pre=0, $label='')	{
-		$out='';
-		$out.=''.$this->fw('Field name:').''.$this->fw($label?$label:'Info:').'';
-		if (is_array($arr))	{
-			reset($arr);
-			while(list($fieldname, $fieldContent)=each($arr))	{
-				if ($pre)	{
+	function displayFields($arr, $pre=0, $label='') {
+			// Get the template file
+		$templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'DisplayFields.html');
+			// Get the template part from the file
+		$template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###');
+			// Define the markers content
+		$templateMarkers = array(
+			'headerFieldName' => 'Field name:',
+			'headerLabel' => $label ? $label : 'Info:'
+		);
+		if (is_array($arr)) {
+			$rows = array();
+				// Get the subpart for rows
+			$rowsSubpart = $this->contentObject->getSubpart($template, '###ROWS###');
+			foreach ($arr as $fieldname => $fieldContent) {
+				if ($pre) {
 					$fieldContent = '
'.trim($fieldContent).'
'; - } else { - $fieldContent = $this->fw($fieldContent); } - $out.=''.$this->fw($fieldname).''.$fieldContent.''; + // Define the markers content + $rowsMarkers = array( + 'fieldName' => $fieldname, + 'fieldContent' => $fieldContent + ); + // Fill the markers in the subpart + $rows[] = $this->contentObject->substituteMarkerArray( + $rowsSubpart, + $rowsMarkers, + '###|###', + 1, + 1 + ); } } - $out = '' . $out . '
'; - return $out; + // Substitute the subpart for rows + $template = $this->contentObject->substituteSubpart( + $template, + '###ROWS###', + implode(chr(10), $rows) + ); + // Fill the markers + $template = $this->contentObject->substituteMarkerArray( + $template, + $templateMarkers, + '###|###', + 1, + 1 + ); + return $template; } /** - * [Describe function...] + * Generates an HTML table with comparison between database and $TCA + * Used in 'Database analyzer > Compare with $TCA' * - * @param [type] $arr: ... - * @param [type] $arr_db: ... - * @return [type] ... + * @param array $arr Description of the table with fieldname and fieldcontent + * @param array $arr_db The actual content of a field in the database + * @return string HTML of the table */ - function displayFieldComp($arr, $arr_db) { - $out=''; - $out.=''.$this->fw('Field name:').' - '.$this->fw("Suggested value from \$TCA:").' - '.$this->fw('Actual value from database:').' - '; - if (is_array($arr)) { - reset($arr); - while(list($fieldname, $fieldContent)=each($arr)) { + function displayFieldComp($arr, $arr_db) { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'DisplayFieldComp.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Define the markers content + $templateMarkers = array( + 'headerFieldName' => 'Field name:', + 'headerSuggested' => 'Suggested value from $TCA:', + 'headerActual' => 'Actual value from database:' + ); + $rows = array(); + if (is_array($arr)) { + // Get the subpart for rows + $rowsSubpart = $this->contentObject->getSubpart($template, '###ROWS###'); + foreach ($arr as $fieldname => $fieldContent) { // This tries to equalize the types tinyint and int $str1 = $fieldContent; $str2 = trim($arr_db[$fieldname]); @@ -4328,76 +7005,151 @@ $str1 = str_replace('int(10)','int(11)',$str1); $str2 = str_replace('int(10)','int(11)',$str2); // Compare: - if (strcmp($str1,$str2)) { + if (strcmp($str1,$str2)) { $bgcolor=' class="warning"'; } else { - $bgcolor=' class="generalTableBackground"'; + $bgcolor=''; } - $fieldContent = $this->fw($fieldContent); - $fieldContent_db = $this->fw($arr_db[$fieldname]); - $out.=' - '.$this->fw($fieldname).' - '.$fieldContent.' - '.$fieldContent_db.' - '; + // Define the markers content + $rowsMarkers = array( + 'fieldName' => $fieldname, + 'fieldContent' => $fieldContent, + 'fieldContentDb' => $arr_db[$fieldname], + 'class' => $bgcolor + ); + // Fill the markers in the subpart + $rows[] = $this->contentObject->substituteMarkerArray( + $rowsSubpart, + $rowsMarkers, + '###|###', + 1, + 1 + ); } } - $out= ''.$out.'
'; + // Substitute the subpart for rows + $template = $this->contentObject->substituteSubpart( + $template, + '###ROWS###', + implode(chr(10), $rows) + ); + // Fill the markers + $out = $this->contentObject->substituteMarkerArray( + $template, + $templateMarkers, + '###|###', + 1, + 1 + ); return $out; } /** - * [Describe function...] + * Generates an HTML table with $TCA suggestions looking at the type of field + * Used in 'Database analyzer > Compare with $TCA' * - * @param [type] $arr: ... - * @param [type] $excludeList: ... - * @return [type] ... + * @param array $arr Description of the table with fieldname and fieldcontent + * @param string $excludeList Comma separated list of fields which should be excluded from this table + * @return string HTML of the table */ - function displaySuggestions($arr, $excludeList='') { - $out=''; - $out.=''.$this->fw('Field name:').''.$this->fw('Info / Suggestion for the field:').''; + function displaySuggestions($arr, $excludeList='') { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'DisplaySuggestions.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + + $templateMarkers = array(); $fC=0; - if (is_array($arr)) { - reset($arr); - while(list($fieldname, $fieldContent)=each($arr)) { - if (!t3lib_div::inList($excludeList,$fieldname) && substr($fieldname,0,strlen($this->deletedPrefixKey))!=$this->deletedPrefixKey && substr($fieldname,-1)!='.') { - $fieldContent = $this->fw($fieldContent); - if ($arr[$fieldname.'.']) { - $fieldContent.= '
'; - $fieldContent.= '
'.trim($arr[$fieldname.'.']).'
'; + $rows = array(); + if (is_array($arr)) { + // Get the subpart for rows + $rowsSubpart = $this->contentObject->getSubpart($template, '###ROWS###'); + foreach ($arr as $fieldname => $fieldContent) { + if (!t3lib_div::inList($excludeList,$fieldname) && substr($fieldname,0,strlen($this->deletedPrefixKey))!=$this->deletedPrefixKey && substr($fieldname,-1)!='.') { + if ($arr[$fieldname.'.']) { + // Get the subpart for pre + $preSubpart = $this->contentObject->getSubpart($rowsSubpart, '###PRE###'); + // Define the markers content + $preMarkers = array( + 'code' => '
' . trim($arr[$fieldname.'.']) . '
' + ); + // Fill the markers in the subpart + $preSubpart = $this->contentObject->substituteMarkerArray( + $preSubpart, + $preMarkers, + '###|###', + 1, + 1 + ); } - $out.=''.$this->fw($fieldname).''.$fieldContent.''; + // Substitute the subpart for pre + $row = $this->contentObject->substituteSubpart( + $rowsSubpart, + '###PRE###', + $preSubpart + ); + // Define the markers content + $rowsMarkers = array( + 'headerFieldName' => 'Field name:', + 'headerLabel' => 'Info:', + 'headerSuggestion' => 'Suggestion for the field:', + 'fieldName' => $fieldname, + 'fieldContent' => $fieldContent, + ); + // Fill the markers in the subpart + $rows[] = $this->contentObject->substituteMarkerArray( + $row, + $rowsMarkers, + '###|###', + 1, + 1 + ); $fC++; } } } - $out= ''.$out.'
'; + // Substitute the subpart for rows + $template = $this->contentObject->substituteSubpart( + $template, + '###ROWS###', + implode(chr(10), $rows) + ); + // Fill the markers + $out = $this->contentObject->substituteMarkerArray( + $template, + $templateMarkers, + '###|###', + 1, + 1 + ); return array($out,$fC); } /** * Compares an array with field definitions with $TCA array * - * @param [type] $FDsrc: ... - * @param [type] $TCA: ... - * @param [type] $onlyFields: ... - * @return [type] ... + * @param array $FDsrc Field definition source + * @param array $TCA The TCA array + * @param boolean $onlyFields + * @return array */ - function compareDatabaseAndTCA($FDsrc, $TCA, $onlyFields=0) { + function compareDatabaseAndTCA($FDsrc, $TCA, $onlyFields=0) { $extraArr=array(); - if (is_array($FDsrc)) { - reset($FDsrc); - while(list($table,$info)=each($FDsrc)) { - if (!isset($TCA[$table])) { - if (!$onlyFields) { - $extraArr[$table]=$info; // If the table was not in the FDcomp-array, the result array is loaded with that table. + if (is_array($FDsrc)) { + foreach ($FDsrc as $table => $info) { + if (!isset($TCA[$table])) { + if (!$onlyFields) { + // If the table was not in the FDcomp-array, the result array is loaded with that table. + $extraArr[$table]=$info; $extraArr[$table]['whole_table']=1; unset($extraArr[$table]['keys']); } } else { $theKey='fields'; $excludeListArr=array(); - if (is_array($TCA[$table]['ctrl']['enablecolumns'])) $excludeListArr[]=$TCA[$table]['ctrl']['enablecolumns']; + if (is_array($TCA[$table]['ctrl']['enablecolumns'])) { + $excludeListArr[]=$TCA[$table]['ctrl']['enablecolumns']; + } $excludeListArr[]=$TCA[$table]['ctrl']['tstamp']; $excludeListArr[]=$TCA[$table]['ctrl']['sortby']; $excludeListArr[]=$TCA[$table]['ctrl']['delete']; @@ -4405,24 +7157,23 @@ $excludeListArr[]=$TCA[$table]['ctrl']['crdate']; $excludeListArr[]='uid'; $excludeListArr[]='pid'; - if ($table=='pages') { + if ($table=='pages') { $excludeListArr[]='perms_userid'; $excludeListArr[]='perms_groupid'; $excludeListArr[]='perms_user'; $excludeListArr[]='perms_group'; $excludeListArr[]='perms_everybody'; } - if ($table=='sys_dmail') { + if ($table=='sys_dmail') { $excludeListArr[]='scheduled'; $excludeListArr[]='scheduled_begin'; $excludeListArr[]='scheduled_end'; $excludeListArr[]='query_info'; } - if (is_array($info[$theKey])) { - reset($info[$theKey]); - while(list($fieldN,$fieldC)=each($info[$theKey])) { - if (!isset($TCA[$table]['columns'][$fieldN]) && !in_array($fieldN,$excludeListArr)) { + if (is_array($info[$theKey])) { + foreach ($info[$theKey] as $fieldN => $fieldC) { + if (!isset($TCA[$table]['columns'][$fieldN]) && !in_array($fieldN,$excludeListArr)) { $extraArr[$table][$theKey][$fieldN] = $info['fields'][$fieldN]; $extraArr[$table][$theKey][$fieldN.'.']=$this->suggestTCAFieldDefinition($fieldN,$fieldC); } @@ -4437,26 +7188,23 @@ /** * Compares the $TCA array with a field definition array * - * @param [type] $TCA: ... - * @param [type] $FDcomp: ... - * @return [type] ... + * @param array $TCA The TCA + * @param array $FDcomp Field definition comparison + * @return array */ - function compareTCAandDatabase($TCA, $FDcomp) { - $extraArr=array(); - $matchingArr=array(); - if (is_array($TCA)) { - reset($TCA); - while(list($table)=each($TCA)) { - $info=$TCA[$table]; - if (!isset($FDcomp[$table])) { -// $extraArr[$table]=$info; // If the table was not in the FDcomp-array, the result array is loaded with that table. + function compareTCAandDatabase($TCA, $FDcomp) { + $matchingArr = $extraArr = array(); + if (is_array($TCA)) { + foreach ($TCA as $table => $info) { + if (!isset($FDcomp[$table])) { + // If the table was not in the FDcomp-array, the result array is loaded with that table. + //$extraArr[$table]=$info; $extraArr[$table]['whole_table']=1; } else { - reset($info['columns']); - while(list($fieldN,$fieldC)=each($info['columns'])) { + foreach ($info['columns'] as $fieldN => $fieldC) { $fieldDef = $this->suggestFieldDefinition($fieldC); - if (!is_array($fieldDef)) { - if (!isset($FDcomp[$table]['fields'][$fieldN])) { + if (!is_array($fieldDef)) { + if (!isset($FDcomp[$table]['fields'][$fieldN])) { $extraArr[$table]['fields'][$fieldN]=$fieldDef; } else { $matchingArr[$table]['fields'][$fieldN]=$fieldDef; @@ -4472,18 +7220,18 @@ /** * Suggests a field definition for a TCA config array. * - * @param [type] $fieldInfo: ... - * @return [type] ... + * @param array $fieldInfo Info of a field + * @return string The suggestion */ - function suggestFieldDefinition($fieldInfo) { + function suggestFieldDefinition($fieldInfo) { $out=''; - switch($fieldInfo['config']['type']) { + switch($fieldInfo['config']['type']) { case 'input': - if (preg_match('/date|time|int|year/',$fieldInfo['config']['eval'])) { + if (preg_match('/date|time|int|year/',$fieldInfo['config']['eval'])) { $out = "int(11) NOT NULL default '0'"; } else { $max = intval($fieldInfo['config']['max']); - if ($max>0 && $max<200) { + if ($max>0 && $max<200) { $out = 'varchar('.$max.") NOT NULL default ''"; } else { $out = 'tinytext'; @@ -4494,42 +7242,45 @@ $out = 'text'; break; case 'check': - if (is_array($fieldInfo['config']['items']) && count($fieldInfo['config']['items'])>8) { + if (is_array($fieldInfo['config']['items']) && count($fieldInfo['config']['items'])>8) { $out = "int(11) NOT NULL default '0'"; } else { $out = "tinyint(3) NOT NULL default '0'"; } break; case 'radio': - if (is_array($fieldInfo['config']['items'])) { + if (is_array($fieldInfo['config']['items'])) { $out = $this->getItemArrayType($fieldInfo['config']['items']); } else { $out = 'ERROR: Radiobox did not have items!'; } break; case 'group': - if ($fieldInfo['config']['internal_type']=='db') { + if ($fieldInfo['config']['internal_type']=='db') { $max = t3lib_div::intInRange($fieldInfo['config']['maxitems'],1,10000); - if (count(explode(',',$fieldInfo['config']['allowed']))>1) { - $len = $max*(10+1+5+1); // Tablenames are 10, "_" 1, uid's 5, comma 1 + if (count(explode(',',$fieldInfo['config']['allowed']))>1) { + // Tablenames are 10, "_" 1, uid's 5, comma 1 + $len = $max*(10+1+5+1); $out=$this->getItemBlobSize($len); } elseif ($max<=1) { $out = "int(11) NOT NULL default '0'"; } else { - $len = $max*(5+1); // uid's 5, comma 1 + // uid's 5, comma 1 + $len = $max*(5+1); $out=$this->getItemBlobSize($len); } } - if ($fieldInfo['config']['internal_type']=='file') { + if ($fieldInfo['config']['internal_type']=='file') { $max = t3lib_div::intInRange($fieldInfo['config']['maxitems'],1,10000); - $len = $max*(30+1); // Filenames is 30+ chars.... + // Filenames is 30+ chars.... + $len = $max*(30+1); $out=$this->getItemBlobSize($len); } break; case 'select': $max = t3lib_div::intInRange($fieldInfo['config']['maxitems'],1,10000); - if ($max<=1) { - if ($fieldInfo['config']['foreign_table']) { + if ($max<=1) { + if ($fieldInfo['config']['foreign_table']) { $out = "int(11) NOT NULL default '0'"; } else { $out = $this->getItemArrayType($fieldInfo['config']['items']); @@ -4547,25 +7298,24 @@ } /** + * Check if field needs to be varchar or int * Private * - * @param [type] $arr: ... - * @return [type] ... + * @param array $arr + * @return string The definition */ - function getItemArrayType($arr) { - if (is_array($arr)) { - reset($arr); - $type[]=0; - $intSize[]=0; - while(list(,$item)=each($arr)) { - if (!t3lib_div::testInt($item[1]) && $item[1]!='--div--') { + function getItemArrayType($arr) { + if (is_array($arr)) { + $type[] = $intSize[] = 0; + foreach ($arr as $item) { + if (!t3lib_div::testInt($item[1]) && $item[1]!='--div--') { $type[]=strlen($item[1]); } else { $intSize[]=$item[1]; } } $us = min($intSize)>=0 ? ' unsigned' : ''; - if (max($type)>0) { + if (max($type)>0) { $out = 'varchar('.max($type).") NOT NULL default ''"; } else { $out = "int(11) NOT NULL default '0'"; @@ -4575,25 +7325,26 @@ } /** + * Defines the blob size of an item by a given length * Private * - * @param [type] $len: ... - * @return [type] ... + * @param integer $len The length + * @return string The blob definition */ - function getItemBlobSize($len) { + function getItemBlobSize($len) { return ($len>255 ? 'tiny' : '').'blob'; } /** * Should suggest a TCA configuration for a specific field. * - * @param [type] $fieldName: ... - * @param [type] $fieldInfo: ... - * @return [type] ... + * @param string $fieldName The field name + * @param string $fieldInfo The field information + * @return string Suggested TCA configuration */ - function suggestTCAFieldDefinition($fieldName,$fieldInfo) { + function suggestTCAFieldDefinition($fieldName,$fieldInfo) { list($type,$len) = preg_split('/ |\(|\)/', $fieldInfo, 3); - switch($type) { + switch($type) { case 'int': $out=" '".$fieldName."' => array ( @@ -4626,7 +7377,7 @@ ),"; break; case 'varchar': - if ($len>10) { + if ($len>10) { $out=" '".$fieldName."' => array ( 'label' => '".strtoupper($fieldName).":', @@ -4732,26 +7483,25 @@ /** * Includes TCA * - * @return [type] ... + * @return void */ - function includeTCA() { + function includeTCA() { global $TCA; include (TYPO3_tables_script ? PATH_typo3conf.TYPO3_tables_script : PATH_t3lib.'stddb/tables.php'); // Extension additions - if ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']) { + if ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']) { include(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php'); } else { include(PATH_t3lib.'stddb/load_ext_tables.php'); } - if (TYPO3_extTableDef_script) { + if (TYPO3_extTableDef_script) { include (PATH_typo3conf.TYPO3_extTableDef_script); } - reset($TCA); - while(list($table)=each($TCA)) { + foreach ($TCA as $table => $conf) { t3lib_div::loadTCA($table); } } @@ -4770,440 +7520,806 @@ **********************/ /** - * This creates a link to the given $url. If $link is set, that'll be the link-text - * - * @param [type] $url: ... - * @param [type] $link: ... - * @return [type] ... - */ - function linkIt($url,$link='') { - return ''.($link?$link:$url).''; - } - - /** * Setting a message in the message-log and sets the fatalError flag if error type is 3. * - * @param string Section header - * @param string A short description - * @param string A long (more detailed) description - * @param integer -1=OK sign, 0=message, 1=notification, 2=warning, 3=error - * @param boolean Print message also in "Advanced" mode (not only in 1-2-3 mode) - * @return void + * @param string $head Section header + * @param string $short_string A short description + * @param string $long_string A long (more detailed) description + * @param integer $type -1=OK sign, 0=message, 1=notification, 2=warning, 3=error + * @param boolean $force Print message also in "Advanced" mode (not only in 1-2-3 mode) + * @return void */ - function message($head, $short_string='', $long_string='', $type=0, $force=0) { - if (!$force && $this->mode=='123' && $type<2) { return; } // Return directly if mode-123 is enabled. + function message($head, $short_string='', $long_string='', $type=0, $force=0) { + // Return directly if mode-123 is enabled. + if (!$force && $this->mode=='123' && $type<2) { + return; + } - if ($type==3) { $this->fatalError=1; } - if ($this->messageFunc_nl2br && !preg_match('/<\/table>/', $long_string)) { - $long_string = nl2br(trim($long_string)); - } else { - $long_string = trim($long_string); - } + if ($type==3) { $this->fatalError=1; } + + $long_string = trim($long_string); + if (!$this->silent) $this->printSection($head, $short_string, $long_string, $type); } /** * This "prints" a section with a message to the ->sections array * - * @param string Section header - * @param string A short description - * @param string A long (more detailed) description - * @param integer -1=OK sign, 0=message, 1=notification, 2=warning , 3=error - * @return void + * @param string $head Section header + * @param string $short_string A short description + * @param string $long_string A long (more detailed) description + * @param integer $type -1=OK sign, 0=message, 1=notification, 2=warning , 3=error + * @return void */ - function printSection($head, $short_string, $long_string, $type) { - switch($type) { + function printSection($head, $short_string, $long_string, $type) { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'PrintSection.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + + switch($type) { case 3: - $cssClass = ' class="typo3-message message-error"'; + $messageType = 'message-error'; break; case 2: - $cssClass = ' class="typo3-message message-warning"'; + $messageType = 'message-warning'; break; case 1: - $cssClass =' class="typo3-message message-notice"'; + $messageType = 'message-notice'; break; case 0: - $cssClass = ' class="typo3-message message-information"'; + $messageType = 'message-information'; break; case -1: - $cssClass = ' class="typo3-message message-ok"'; + $messageType = 'message-ok'; break; } - if (!trim($short_string)) { - $this->sections[$head][]=''; + if (!trim($short_string)) { + $content = ''; } else { - $this->sections[$head][]=' - ' . '' . $this->fw($short_string) . '' . (trim($long_string) ? ' - ' . $this->fw($long_string) . '

' : ''); + if (trim($long_string)) { + // Get the subpart for the long string + $longStringSubpart = $this->contentObject->getSubpart($template, '###LONGSTRINGAVAILABLE###'); + } + // Substitute the subpart for the long string + $content = $this->contentObject->substituteSubpart( + $template, + '###LONGSTRINGAVAILABLE###', + $longStringSubpart + ); + // Define the markers content + $markers = array( + 'messageType' => $messageType, + 'shortString' => $short_string, + 'longString' => $long_string + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $content, + $markers, + '###|###', + 1, + 1 + ); } + $this->sections[$head][] = $content; } /** - * Wraps the str in a font-tag with verdana 1 + * This prints all the messages in the ->section array * - * @param [type] $str: ... - * @param [type] $size: ... - * @return [type] ... + * @return string HTML of all the messages */ - function fw($str,$size=1) { + function printAll() { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'PrintAll.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + $sections = array(); - if (preg_match('/^$/', $str)) { - // no wrap - } else { - if($size==1) { - $size = 'class="smalltext"'; - } elseif ($size==2) { - $size = 'class="bodytext"'; - } else { - $size = 'size="size'.$size.'text"'; - } - $str = ''.$str.''; + foreach ($this->sections as $header => $valArray) { + // Get the subpart for sections + $sectionSubpart = $this->contentObject->getSubpart($template, '###SECTIONS###'); + // Define the markers content + $sectionMarkers = array( + 'header' => $header . ':', + 'sectionContent' => implode(chr(10), $valArray) + ); + // Fill the markers in the subpart + $sections[] = $this->contentObject->substituteMarkerArray( + $sectionSubpart, + $sectionMarkers, + '###|###', + 1, + 1 + ); } - return $str; - } + // Substitute the subpart for the sections + $content = $this->contentObject->substituteSubpart( + $template, + '###SECTIONS###', + implode(chr(10), $sections) + ); - /** - * Wraps the str in a font-tag with verdana 1 - * - * @param [type] $str: ... - * @return [type] ... - */ - function fwheader($str) { - return '
'.$this->fw($str,3).'
'; + return $content; } /** - * Wrapping labal/content in a table-row. + * This wraps and returns the main content of the page into proper html-code. * - * @param [type] $label: ... - * @param [type] $content: ... - * @return [type] ... + * @param string $content The page content + * @return string The full HTML page */ - function wrapInCells($label,$content) { - return ''; - } + function outputWrapper($content) { + // Get the template file + if (!$this->passwordOK) { + $this->template = @file_get_contents(PATH_site . $this->templateFilePath . 'Install_login.html'); + } elseif ($this->mode == '123') { + $this->template = @file_get_contents(PATH_site . $this->templateFilePath . 'Install_123.html'); + } else { + $this->template = @file_get_contents(PATH_site . $this->templateFilePath . 'Install.html'); + } - /** - * This prints all the messages in the ->section array - * - * @return [type] ... - */ - function printAll() { - reset($this->sections); - $out=''; - while(list($header,$valArray)=each($this->sections)) { - $out.=' - - - '; - $out.=implode($valArray,chr(10)); + // Include the default stylesheets + $this->stylesheets[] = ''; + $this->stylesheets[] = ''; + + // Include the stylesheets based on screen + if ($this->mode == '123') { + $this->stylesheets[] = ''; + } elseif ($this->passwordOK) { + $this->stylesheets[] = ''; + if (!$this->session->inBackend()) { + $this->stylesheets[] = ''; + } + } else { + $this->stylesheets[] = ''; + if (!$this->session->inBackend()) { + $this->stylesheets[] = ''; + } } - return '
'.$this->fw($label).' '.$this->fw($content).'
 
'.$this->fw($header.':',2).'
'.$out.'
'; - } - /** - * This wraps and returns the main content of the page into proper html-code. - * - * @param string The page content - * @return string The full HTML page - */ - function outputWrapper($content) { - $out=' - - - - -'.$this->headerStyle.' - - TYPO3 Install Tool - '.($this->JSmessage?' - + // Include javascript message + $this->javascript[] = $this->JSmessage ? + '' : + ''; - ':'').' - - - '.$this->contentBeforeTable.' -
'; - if($this->INSTALL['type'] == 'about') { - $out .= ''; + // Define the markers content + if ($this->mode == '123') { + $this->markers['headTitle'] = 'Installing TYPO3 ' . TYPO3_branch; } else { - $out .= '
'; + $this->markers['headTitle'] = ' + TYPO3 ' . TYPO3_version . ' + Install tool on site: ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' + '; } - $out .= ' - - - - - -
- - - - -
-
TYPO3 '.TYPO3_branch.' Install Tool
-
Site: '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].'
- '.($this->passwordOK ? '
Version: '.TYPO3_version.'
':'').'
+ $this->markers['title'] = 'TYPO3 ' . TYPO3_version; + $this->markers['javascript'] = implode(chr(10), $this->javascript); + $this->markers['stylesheets'] = implode(chr(10), $this->stylesheets); + $this->markers['llErrors'] = 'The following errors occured'; + $this->markers['copyright'] = $this->copyright(); + $this->markers['charset'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] : 'iso-8859-1'; + $this->markers['backendUrl'] = '../index.php'; + $this->markers['backend'] = 'Backend admin'; + $this->markers['frontendUrl'] = '../../index.php'; + $this->markers['frontend'] = 'Frontend website'; -'.($this->step?$this->stepHeader():$this->menu()).$content.'
'.$this->note123().$this->endNotes().' -
-
-
- -'; - return $out; + $this->markers['metaCharset'] = 'Content-Type" content="text/html; charset='; + if (!empty($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'])) { + $this->markers['metaCharset'] .= $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']; + } else { + $this->markers['metaCharset'] .= 'iso-8859-1'; + } + + // Add the error messages + if (!empty($this->errorMessages)) { + // Get the subpart for all error messages + $errorMessagesSubPart = $this->contentObject->getSubpart($this->template, '###ERRORMESSAGES###'); + // Get the subpart for a single error message + $errorMessageSubPart = $this->contentObject->getSubpart($errorMessagesSubPart, '###MESSAGES###'); + $errors = array(); + + foreach ($this->errorMessages as $errorMessage) { + // Define the markers content + $errorMessageMarkers = array( + 'message' => $errorMessage + ); + // Fill the markers in the subpart + $errors[] = $this->contentObject->substituteMarkerArray( + $errorMessageSubPart, + $errorMessageMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for a single message + $errorMessagesSubPart = $this->contentObject->substituteSubpart( + $errorMessagesSubPart, + '###MESSAGES###', + implode(chr(10), $errors) + ); + } + + // Version subpart is only allowed when password is ok + if ($this->passwordOK) { + // Get the subpart for the version + $versionSubPart = $this->contentObject->getSubpart($this->template, '###VERSIONSUBPART###'); + // Define the markers content + $versionSubPartMarkers['version'] = 'Version: ' . TYPO3_version; + // Fill the markers in the subpart + $versionSubPart = $this->contentObject->substituteMarkerArray( + $versionSubPart, + $versionSubPartMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the version subpart + $this->template = $this->contentObject->substituteSubpart( + $this->template, + '###VERSIONSUBPART###', + $versionSubPart + ); + // Substitute the menu subpart + $this->template = $this->contentObject->substituteSubpart( + $this->template, + '###MENU###', + $this->menu() + ); + // Substitute the error messages subpart + $this->template = $this->contentObject->substituteSubpart( + $this->template, + '###ERRORMESSAGES###', + $errorMessagesSubPart + ); + // Substitute the content subpart + $this->template = $this->contentObject->substituteSubpart( + $this->template, + '###CONTENT###', + $content + ); + // Fill the markers + $this->template = $this->contentObject->substituteMarkerArray( + $this->template, + $this->markers, + '###|###', + 1, + 1 + ); + + return $this->template; } /** * Sends the page to the client. * - * @param string The HTML page + * @param string $content The HTML page + * @return void */ - function output($content) { + function output($content) { header ('Content-Type: text/html; charset=' . ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']?$GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']:'iso-8859-1')); echo $content; } /** - * [Describe function...] + * Generates the main menu * - * @return [type] ... + * @return string HTML of the main menu */ - function menu() { - if (!$this->passwordOK) return; + function menu() { + if ($this->mode !='123') { + if (!$this->passwordOK) return; - reset($this->menuitems); - $c=0; - $out=array(); - while(list($k,$v)=each($this->menuitems)) { - $bgcolor = ($this->INSTALL['type']==$k ? ' class="activeMenu"' : ' class="generalTableBackground"'); - $c++; - $out[]=''.$this->fw($c.': '.$v).''; + $c = 0; + $items = array(); + // Get the subpart for the main menu + $menuSubPart = $this->contentObject->getSubpart($this->template, '###MENU###'); + // Get the subpart for each single menu item + $menuItemSubPart = $this->contentObject->getSubpart($this->template, '###MENUITEM###'); + + foreach ($this->menuitems as $k => $v) { + // Define the markers content + $markers = array( + 'class' => ($this->INSTALL['type']==$k ? 'class="act"' : ''), + 'id' => $k, + 'url' => htmlspecialchars( + $this->scriptSelf . + '?TYPO3_INSTALL[type]=' . + $k . + ($this->mode ? '&mode=' . rawurlencode($this->mode) : '') + ), + 'item' => $v + ); + // Fill the markers in the subpart + $items[] = $this->contentObject->substituteMarkerArray( + $menuItemSubPart, + $markers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for the single menu items + $menuSubPart = $this->contentObject->substituteSubpart( + $menuSubPart, + '###MENUITEM###', + implode(chr(10), $items) + ); + + return $menuSubPart; } - - $code = ''.implode($out,chr(10)).'
'; - $code = ''; - return '
'.$code.'
'; } /** - * [Describe function...] + * Generates the step header for 1-2-3 mode, the numbers at the top * - * @return [type] ... + * @return string HTML for the step header */ - function stepHeader() { - $msg1='Type in your database parameters here:'; - $msg2='Database'; - $msg3='Import the database sql-file'; - $msg4='You\'re done!'; - $out=' - - - - - - + function stepHeader() { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'StepHeader.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Get the subpart for each item + $stepItemSubPart = $this->contentObject->getSubpart($template, '###STEPITEM###'); + $steps = array(); -
'; - $msg=''; - switch(strtolower($this->step)) { - case 1: - $msg=$msg1; - break; - case 2: - $msg=$msg2; - break; - case 3: - $msg=$msg3; - break; - case 'go': - $msg=$msg4; - break; - default: - break; + for ($counter = 2; $counter <= $this->totalSteps; $counter++) { + $state = ''; + + if ($this->step === $counter) { + $state = 'act'; + } elseif ($this->step === 'go' || $counter < $this->step) { + $state = 'done'; + } + // Define the markers content + $stepItemMarkers = array( + 'class' => 'class="step' . ($counter - 1) . ($state ? ' ' . $state : '') . '"', + 'url' => $this->scriptSelf . '?mode=' . $this->mode . '&step=' . $counter, + 'step' => $counter + ); + // Fill the markers in the subpart + $steps[] = $this->contentObject->substituteMarkerArray( + $stepItemSubPart, + $stepItemMarkers, + '###|###', + 1, + 1 + ); } - $out.='
'.$this->fw($msg,2).'
'; + // Substitute the subpart for the items + $content = $this->contentObject->substituteSubpart( + $template, + '###STEPITEM###', + implode(chr(10), $steps) + ); - return $out; + return $content; } /** - * [Describe function...] + * Generate HTML for the security risk message * - * @return [type] ... + * @return string HTML for the security risk message */ - function note123() { - if ($this->mode=='123') { - $c=' - -
' . $this->fontTag1 . 'NOTICE: Install Tool is running in \'123\' mode. Click here to disable.
'; - return $c; - } + function securityRisk() { + return ' +

+ This script is a + great danger to the security of TYPO3 + if you don\'t secure it somehow. +
+ We suggest one of the following: +

+
    +
  • + Change the password as defined by the md5-hash in + TYPO3_CONF_VARS[BE][installToolPassword] +
  • +
  • + Delete the folder \'typo3/install/\' with this script in or + just insert an \'exit;\' line in the script-file there +
  • +
  • + Password protect the \'typo3/install/\' folder, eg. with a + .htaccess file +
  • +
+

+ The TYPO3_CONF_VARS[BE][installToolPassword] is always active, + but choosing one of the other options will improve security and + is recommended highly. +

+ '; } /** - * [Describe function...] + * Generates the form to alter the password of the install tool * - * @return [type] ... + * @return string HTML of the form */ - function endNotes() { - if ($this->mode!='123' && $this->passwordOK) { - $c.='OS detected: '.(TYPO3_OS=='WIN'?'WIN':'UNIX').'
'; - $c.='UNIX/CGI detected: '.(PHP_SAPI=='cgi' ? 'YES' : 'NO').'
'; - $c.='PATH_thisScript: '.PATH_thisScript.'
'; - $c.='
'; - $c.='Backend admin in new window.
'; - $c.='Frontend website in new window.
'; + function alterPasswordForm() { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'AlterPasswordForm.html'); + // Get the template part from the file + $template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Define the markers content + $markers = array( + 'action' => $this->scriptSelf.'?TYPO3_INSTALL[type]=extConfig', + 'enterPassword' => 'Enter new password:', + 'enterAgain' => 'Enter again:', + 'submit' => 'Set new password' + ); + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $template, + $markers, + '###|###', + 1, + 1 + ); - return $this->fw($c); - } + return $content; } /** - * Convert a size from human-readable form into bytes + * Generate HTML for the copyright * - * @param string A string containing the size in bytes, kilobytes or megabytes. Example: 64M - * @return string The string is returned in bytes and can also hold floating values + * @return string HTML of the copyright */ - function convertByteSize($bytes) { - if (stristr($bytes,'m')) { - $bytes=doubleval($bytes)*1024*1024; - } elseif (stristr($bytes,'k')) { - $bytes=doubleval($bytes)*1024; - } - return $bytes; - } - - /** - * [Describe function...] - * - * @return [type] ... - */ - function securityRisk() { - $c='This script is a great danger to the security of TYPO3 if you don\'t secure it somehow. - We suggest one of the following: - - - change the password as defined by the md5-hash in TYPO3_CONF_VARS[BE][installToolPassword]. - - delete the folder \'typo3/install/\' with this script in or just insert an \'exit;\' line in the script-file there. - - password protect the \'typo3/install/\' folder, eg. with a .htaccess file - - The TYPO3_CONF_VARS[BE][installToolPassword] is always active, but choosing one of the other options will improve security and is recommended highly. + function copyright() { + $content = ' +

+ TYPO3 CMS. Copyright © 1998-' . date('Y') . ' + Kasper Skårhøj. Extensions are copyright of their respective + owners. Go to http://typo3.com/ + for details. TYPO3 comes with ABSOLUTELY NO WARRANTY; + click for details. + This is free software, and you are welcome to redistribute it + under certain conditions; click for details. Obstructing the + appearance of this notice is prohibited by law. +

+

+ Donate | + TYPO3.org +

'; - return $c; - } - /** - * [Describe function...] - * - * @return [type] ... - */ - function alterPasswordForm() { - $content = ' - Enter new password: -
Enter again: - - -
- '; - return $content; + return $content; } /** - * [Describe function...] + * Generate HTML for the message that the basic setup has been finished * - * @return [type] ... + * @return string HTML of the message */ - function messageBasicFinished() { - $msg =' + function messageBasicFinished() { + return ' +

Apparently you have completed the basic setup of the TYPO3 database. +
Now you can choose between these options: - - - Go to the frontend pages - - - Go to the backend login - (username may be: admin, password may be: password.) - - - Continue to configure TYPO3 (Recommended). - This will let you analyse and verify that everything in your PHP installation is alright. Also if you want to configure TYPO3 to use all the cool features, you must dig into the this! - '; - return $msg; +

+ + '; } /** - * [Describe function...] + * Make the url of the script according to type, mode and step * - * @param [type] $type: ... - * @return [type] ... + * @param string $type The type + * @return string The url */ - function setScriptName($type) { + function setScriptName($type) { $value = $this->scriptSelf.'?TYPO3_INSTALL[type]='.$type.($this->mode?'&mode='.rawurlencode($this->mode):'').($this->step?'&step='.rawurlencode($this->step):''); return $value; } /** - * [Describe function...] + * Return the filename that will be used for the backup. + * It is important that backups of PHP files still stay as a PHP file, otherwise they could be viewed un-parsed in clear-text. * - * @param [type] $size: ... - * @param [type] $textarea: ... - * @param [type] $styleOverride: ... - * @return [type] ... + * @param string $filename Full path to a file + * @return string The name of the backup file (again, including the full path) */ - function formWidth($size=48,$textarea=0,$styleOverride='') { - // Input or text-field attribute (size or cols) - $wAttrib = $textarea?'cols':'size'; - if (!$GLOBALS['CLIENT']['FORMSTYLE']) { // If not setting the width by style-attribute - $size = ceil($size*1); - $retVal = ' '.$wAttrib.'="'.$size.'"'; - } else { // Setting width by style-attribute. "cols" MUST be avoided with NN6+ - $pixels = ceil($size*10); - $retVal = $styleOverride ? ' style="'.$styleOverride.'"' : ' style="width:'.$pixels.'px;"'; + function getBackupFilename($filename) { + if (preg_match('/\.php$/', $filename)) { + $backupFile = str_replace('.php', '_bak.php', $filename); + } else { + $backupFile = $filename.'~'; } - return $retVal; + + return $backupFile; } /** - * [Describe function...] + * Creates a table which checkboxes for updating database. * - * @param [type] $size: ... - * @param [type] $styleOverride: ... - * @param [type] $wrap: ... - * @return [type] ... + * @param array $arr Array of statements (key / value pairs where key is used for the checkboxes) + * @param string $label Label for the table. + * @param boolean $checked If set, then checkboxes are set by default. + * @param boolean $iconDis If set, then icons are shown. + * @param array $currentValue Array of "current values" for each key/value pair in $arr. Shown if given. + * @param boolean $cVfullMsg If set, will show the prefix "Current value" if $currentValue is given. + * @return string HTML table with checkboxes for update. Must be wrapped in a form. */ - function formWidthText($size=48,$styleOverride='',$wrap='') { - $wTags = $this->formWidth($size,1,$styleOverride); - // Netscape 6+ seems to have this ODD problem where there WILL ALWAYS be wrapping with the cols-attribute set and NEVER without the col-attribute... - if (strtolower(trim($wrap))!='off' && $GLOBALS['CLIENT']['BROWSER']=='net' && $GLOBALS['CLIENT']['VERSION']>=5) { - $wTags.=' cols="'.$size.'"'; + function generateUpdateDatabaseForm_checkboxes($arr,$label,$checked=1,$iconDis=0,$currentValue=array(),$cVfullMsg=0) { + $out = array(); + $tableId = uniqid('table'); + $templateMarkers = array(); + if (is_array($arr)) { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'GenerateUpdateDatabaseFormCheckboxes.html'); + // Get the template part from the file + $content = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Define the markers content + $templateMarkers = array( + 'label' => $label, + 'tableId' => $tableId + ); + // Select/Deselect All + if (count($arr) > 1) { + // Get the subpart for multiple tables + $multipleTablesSubpart = $this->contentObject->getSubpart($content, '###MULTIPLETABLES###'); + // Define the markers content + $multipleTablesMarkers = array( + 'label' => $label, + 'tableId' => $tableId, + 'checked' => ($checked ? ' checked="checked"' : ''), + 'selectAllId' => $tableId . '-checkbox', + 'selectDeselectAll' => 'select/deselect all' + ); + // Fill the markers in the subpart + $multipleTablesSubpart = $this->contentObject->substituteMarkerArray( + $multipleTablesSubpart, + $multipleTablesMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for multiple tables + $content = $this->contentObject->substituteSubpart( + $content, + '###MULTIPLETABLES###', + $multipleTablesSubpart + ); + // Rows + foreach ($arr as $key => $string) { + // Get the subpart for rows + $rowsSubpart = $this->contentObject->getSubpart($content, '###ROWS###'); + $currentSubpart = ''; + $ico = ''; + $warnings = array(); + // Define the markers content + $rowsMarkers = array( + 'checkboxId' => 'db-' . $key, + 'name' => $this->dbUpdateCheckboxPrefix . '[' . $key . ']', + 'checked' => ($checked ? 'checked="checked"' : ''), + 'string' => htmlspecialchars($string) + ); + + if ($iconDis) { + $iconMarkers['backPath'] = $this->backPath; + if (preg_match('/^TRUNCATE/i', $string)) { + $iconMarkers['iconText'] = ''; + $warnings['clear_table_info'] = 'Clearing the table is sometimes neccessary when adding new keys. In case of cache_* tables this should not hurt at all. However, use it with care.'; + } elseif (stristr($string,' user_')) { + $iconMarkers['iconText'] = '(USER)'; + } elseif (stristr($string,' app_')) { + $iconMarkers['iconText'] = '(APP)'; + } elseif (stristr($string,' ttx_') || stristr($string,' tx_')) { + $iconMarkers['iconText'] = '(EXT)'; + } + + if (!empty($iconMarkers)) { + // Get the subpart for icons + $iconSubpart = $this->contentObject->getSubpart($content, '###ICONAVAILABLE###'); + // Fill the markers in the subpart + $iconSubpart = $this->contentObject->substituteMarkerArray( + $iconSubpart, + $iconMarkers, + '###|###', + 1, + 1 + ); + } + } + // Substitute the subpart for icons + $rowsSubpart = $this->contentObject->substituteSubpart( + $rowsSubpart, + '###ICONAVAILABLE###', + $iconSubpart + ); + + if (isset($currentValue[$key])) { + // Get the subpart for current + $currentSubpart = $this->contentObject->getSubpart($rowsSubpart, '###CURRENT###'); + // Define the markers content + $currentMarkers = array ( + 'message' => (!$cVfullMsg ? 'Current value:': ''), + 'value' => $currentValue[$key] + ); + // Fill the markers in the subpart + $currentSubpart = $this->contentObject->substituteMarkerArray( + $currentSubpart, + $currentMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for current + $rowsSubpart = $this->contentObject->substituteSubpart( + $rowsSubpart, + '###CURRENT###', + $currentSubpart + ); + // Fill the markers in the subpart + $rowsSubpart = $this->contentObject->substituteMarkerArray( + $rowsSubpart, + $rowsMarkers, + '###|###', + 1, + 1 + ); + + $rows[] = $rowsSubpart; + } + // Substitute the subpart for rows + $content = $this->contentObject->substituteSubpart( + $content, + '###ROWS###', + implode(chr(10), $rows) + ); + + if (count($warnings)) { + // Get the subpart for warnings + $warningsSubpart = $this->contentObject->getSubpart($content, '###WARNINGS###'); + + foreach ($warnings as $warning) { + // Get the subpart for single warning items + $warningItemSubpart = $this->contentObject->getSubpart($warningsSubpart, '###WARNINGITEM###'); + // Define the markers content + $warningItemMarker['warning'] = $warning; + // Fill the markers in the subpart + $warningItem[] = $this->contentObject->substituteMarkerArray( + $warningItemSubpart, + $warningItemMarker, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for single warning items + $warningsSubpart = $this->contentObject->substituteSubpart( + $warningsSubpart, + '###WARNINGITEM###', + implode(chr(10), $warningItems) + ); + } + // Substitute the subpart for warnings + $content = $this->contentObject->substituteSubpart( + $content, + '###WARNINGS###', + implode(chr(10), $warningsSubpart) + ); } - return $wTags; + // Fill the markers + $content = $this->contentObject->substituteMarkerArray( + $content, + $templateMarkers, + '###|###', + 1, + 1 + ); + + return $content; } /** - * Return the filename that will be used for the backup. - * It is important that backups of PHP files still stay as a PHP file, otherwise they could be viewed un-parsed in clear-text. + * Returns HTML-code, which is a visual representation of a multidimensional array + * Returns false if $array_in is not an array * - * @param string Full path to a file - * @return string The name of the backup file (again, including the full path) + * @param mixed $incomingValue Array to view + * @return string HTML output */ - function getBackupFilename($filename) { - if (preg_match('/\.php$/', $filename)) { - $backupFile = str_replace('.php', '_bak.php', $filename); - } else { - $backupFile = $filename.'~'; + function viewArray($incomingValue) { + // Get the template file + $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'ViewArray.html'); + + if (is_array($incomingValue) && !empty($incomingValue)) { + // Get the template part from the file + $content = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###'); + // Get the subpart for a single item + $itemSubpart = $this->contentObject->getSubpart($content, '###ITEM###'); + + foreach ($incomingValue as $key => $value) { + if (is_array($value)) { + $description = $this->viewArray($value); + } elseif (is_object($value)) { + $description = get_class($value); + if (method_exists($value, '__toString')) { + $description .= ': ' . (string)$value; + } + } else { + if (gettype($value) == 'object') { + $description = 'Unknown object'; + } else { + $description = htmlspecialchars((string) $value); + } + } + // Define the markers content + $itemMarkers = array( + 'key' => htmlspecialchars((string) $key), + 'description' => !empty($description) ? $description : ' ' + ); + // Fill the markers in the subpart + $items[] = $this->contentObject->substituteMarkerArray( + $itemSubpart, + $itemMarkers, + '###|###', + 1, + 1 + ); + } + // Substitute the subpart for single item + $content = $this->contentObject->substituteSubpart( + $content, + '###ITEM###', + implode(chr(10), $items) + ); } - - return $backupFile; + return $content; } /** * Returns a newly created TYPO3 encryption key with a given length. * - * @param integer $keyLength desired key length - * @return string + * @param integer $keyLength Desired key length + * @return string The encryption key */ protected function createEncryptionKey($keyLength = 96) { $bytes = t3lib_div::generateRandomBytes($keyLength); @@ -5211,8 +8327,7 @@ } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/install/mod/class.tx_install.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/install/mod/class.tx_install.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/install/mod/class.tx_install.php']); } - -?> +?> \ No newline at end of file Index: typo3/sysext/install/mod/class.tx_install_session.php =================================================================== --- typo3/sysext/install/mod/class.tx_install_session.php (revision 7289) +++ typo3/sysext/install/mod/class.tx_install_session.php (working copy) @@ -75,6 +75,13 @@ private $regenerateSessionIdTime = 5; /** + * part of the referer when the install tool has been called from the backend + * + * @var string + */ + private $backendFile = 'backend.php'; + + /** * Constructor. Starts PHP session handling in our own private store * * Side-effect: might set a cookie, so must be called before any other output. @@ -136,6 +143,14 @@ */ public function startSession() { $_SESSION['created'] = time(); + + $referer = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER')); + if (strpos($referer['path'], $this->backendFile)) { + $_SESSION['backend'] = TRUE; + } else { + $_SESSION['backend'] = FALSE; + } + return session_id(); } @@ -240,6 +255,18 @@ } /** + * Check if the install tool is called in the backend + * + * @return boolean True if the install tool has been called from the backend + */ + public function inBackend() { + if ($_SESSION['backend']) { + return TRUE; + } + return FALSE; + } + + /** * Refreshes our session information, rising the expire time. * Also generates a new session ID every 5 minutes to minimize the risk of * session hijacking. Index: typo3/sysext/install/mod/install.css =================================================================== --- typo3/sysext/install/mod/install.css (revision 7289) +++ typo3/sysext/install/mod/install.css (working copy) @@ -1,282 +0,0 @@ -/* $Id$ */ - -body, p, td, a, span, input, .bodytext { - font-family: verdana, arial, helvetica, sans-serif; - font-size: 1em; - color: #000; - text-align: left; - word-wrap: break-word; -} - -h1, -h2 { - font-family: verdana, arial, helvetica, sans-serif; - font-weight: bold; -} - -h1 { - font-size: 14pt; -} - -h2 { - font-size: 12pt; -} - -a { - color: #600; - text-decoration: none; -} - -a:active { - text-decoration: none; -} - -a:hover { - color: #006; - text-decoration: underline; -} - -table { - width: 100%; -} - -th { - font-size: 10pt; - font-weight: bold; -} - -textarea { - width: 99%; -} - -.outerTable { - width: 80%; - max-width: 900px; -} - -* html .outerTable { - width: 900px; -} - -.smallOuterTable { - width:600px; -} - -.logo { - text-align: center; -} - -.smalltext { - font-size: 0.9em; - display: inline; -} - -.bodytext { - display: inline; -} - -.size3text { - font-size: 1.2em; -} - -.size4text { - font-size: 1.5em; -} - -.generalTableBackground { - background-color: #efeff4; -} - -.activeMenu { - background-color: #66a552; -} - -.createBorder { - background-color: black; -} - -.editFile { - text-align: center; - max-width: 900px; - width: 80%; - margin: auto; -} - -* html .editFile { - width: 900px; -} - -.siteInfo { - color: navy; -} - -.updateWizardBoxes { - border: 1px solid; - margin: 10px; - padding: 0px 10px 10px; -} - - -.tcaTableHeader { - background-color: #b3b7bd; - padding: 2px; -} -.tcaTableBackground { - background-color: #e4e5f0; - padding: 2px; -} - -/* Styles for messages (matching flash messages) */ - -.typo3-message { - padding: 6px; - padding-left: 26px; - margin-bottom: 4px; - background-repeat: no-repeat; - background-position: 5px 7px; - border: 1px solid; -} -.message-notice { - background-image: url("../../../gfx/notice.png"); - background-color: #f6f7fa; - border-color: #c2cbcf; -} -.message-information { - background-image: url("../../../gfx/information.png"); - background-color: #ddeef9; - border-color: #8aafc4; -} -.message-ok { - background-image: url("../../../gfx/ok.png"); - background-color: #cdeaca; - border-color: #58b548; -} -.message-warning { - background-image: url("../../../gfx/warning.png"); - background-color: #fbffb3; - border-color: #c4b70d; -} -.message-error { - background-image: url("../../../gfx/error.png"); - background-color: #fbb19b; - border-color: #dc4c42; -} -/* Colors to match above message styles, but without the icon in the background */ -.warning { - background-color: #fbffb3; -} -.notice { - background-color: #f6f7fa; -} - - -/* Menus */ -#imageMenu, -#menu { - width: 300px; - background-color: #b3b7bd; -} - -#imageMenu td.generalTableBackground a, -#menu td.generalTableBackground a, -#menu td.activeMenu a { - display: block; - text-decoration: none; -} - -#imageMenu td.generalTableBackground a:hover, -#menu td.generalTableBackground a:hover { - display: block; - background-color: #fa8800; - text-decoration: none; -} - -#imageMenu td.activeMenu a span, -#imageMenu td.generalTableBackground a:hover span, -#menu td.activeMenu a span, -#menu td.generalTableBackground a:hover span { - color: #fff; - text-decoration: none; -} - -#imageMenu td.activeMenu a, -#menu td.activeMenu a { - color: #fff; - text-decoration: none; -} - - -/* phpinfo */ -pre { - margin: 0px; - font-family: monospace; -} -.phpinfo table { - border-collapse: collapse; -} -.center { - text-align: center; -} -.center table { - margin-left: auto; - margin-right: auto; - text-align: left; -} - -.center th { - text-align: center !important; -} -.phpinfo td, -.phpinfo th { - border: 1px solid #000000; - font-size: 75%; - vertical-align: baseline; -} - -h1 { - font-size: 150%; -} - -h2 { - font-size: 125%; -} - -.p { - text-align: left; -} - -.e { - background-color: #ccf; - font-weight: bold; - color: #000000; -} - -.h { - background-color: #99c; - font-weight: bold; - color: #000000; -} - -.v { - background-color: #ccc; - color: #000000; -} - -.vr { - background-color: #ccc; - text-align: right; - color: #000000; -} - -.phpinfo img { - float: right; - border: 0px; -} - -.phpinfo hr { - width: 600px; - background-color: #ccc; - border: 0px; - height: 1px; - color: #000000; -} Index: typo3/sysext/install/mod/install.js =================================================================== --- typo3/sysext/install/mod/install.js (revision 7289) +++ typo3/sysext/install/mod/install.js (working copy) @@ -1,49 +0,0 @@ -/*************************************************************** -* -* Javascript functions to provide AJAX calls for install tool -* -* Copyright notice -* -* (c) 2009 Marcus Krause, Helmut Hummel -* All rights reserved -* -* This script is part of the TYPO3 backend provided by -* Kasper Skaarhoj together with TYPO3 -* -* Released under GNU/GPL (see license file in /typo3/) -* -* 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. -* -* This copyright notice MUST APPEAR in all copies of this script -* -***************************************************************/ - - -/** - * - * @author Marcus Krause - */ -var EncryptionKey = { - thisScript: '../../index.php', - eID: 'tx_install_ajax', - cmd: 'encryptionKey', - - // loads the ecryption key by an AJAX call - load: function(obj) { - // fallback if AJAX is not possible (e.g. IE < 6) - if (typeof Ajax.getTransport() != 'object') { - window.location.href = this.thisScript + '?eID=' + this.eID + '&cmd=' + this.cmd; - return; - } - - new Ajax.Request(this.thisScript, { - method: 'get', - parameters: '?eID=' + this.eID + '&cmd=' + this.cmd, - onComplete: function(xhr) { - document.getElementsByName('TYPO3_INSTALL[localconf.php][encryptionKey]').item(0).value=xhr.responseText; - }.bind(this) - }); - } -}; Index: typo3/sysext/install/Resources/Private/Templates/AlterPasswordForm.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/AlterPasswordForm.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/AlterPasswordForm.html (revision 0) @@ -0,0 +1,39 @@ + + + + + + + Template: Alter Password Form + + + +
+
+
    +
  1. + + +
  2. +
  3. + + +
  4. + +
+
+
+
    +
  1. + +
  2. +
+
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/CheckImageMagick.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/CheckImageMagick.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/CheckImageMagick.html (revision 0) @@ -0,0 +1,51 @@ + + + + + + + Template: Check ImageMagick + + + + + + + + + + + +
###FILE######TYPE######VERSION###
+ + + +
+
+
    +
  1. + + +
  2. +
  3. + + +
  4. +
  5. + ###COMMENT### +
  6. +
+
+
+
    +
  1. + +
  2. +
+
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/CheckMail.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/CheckMail.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/CheckMail.html (revision 0) @@ -0,0 +1,39 @@ + + + + + + + Template: Check Mail + + + + +

###MESSAGE###

+ +
+
+
    +
  1. + + +
  2. +
  3. + + +
  4. +
+
+
+
    +
  1. + +
  2. +
+
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseAdminUser.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseAdminUser.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseAdminUser.html (revision 0) @@ -0,0 +1,35 @@ + + + + + + + Template: Check the database admin user + + + +
+
    +
  1. + + +
  2. +
+
+
+
    +
  1. + + +
  2. +
  3. + + +
  4. +
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseCache.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseCache.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseCache.html (revision 0) @@ -0,0 +1,48 @@ + + + + + + + Template: Check the database cache + + + +
    + +
  • + ###TABLENAME### +
  • + +
+ + + +
+
    + +
  1. + + +
  2. + + +
  3.  
  4. + +
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseImport.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseImport.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseImport.html (revision 0) @@ -0,0 +1,50 @@ + + + + + + + Template: Check the database Import + + + + +
+
    + +
  1. + + +
  2. + +
+
+ +
+
    +
  1. + + +
  2. +
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseMenu.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseMenu.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseMenu.html (revision 0) @@ -0,0 +1,117 @@ + + + + + + + Template: Check the database Menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ###UPDATEREQUIREDTABLES### + + + ###COMPARE### + + +   + +   +
+ ###DUMPSTATICDATA### + +   + + + ###IMPORT### + + +   +
+   +
+ ###FILESHORTNAME### (###FILESIZE###) + + + ###COMPARE### + + + + ###IMPORT######SPECS### + + + + ###VIEW######SPECS### + +
+   + + + ###COMPAREWITHTCA### + +
+   + + + ###CREATEADMINUSER### + +
+   + + + ###RESETUSERPREFERENCES### + +
+   + + + ###CLEARTABLES### + +
+ + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseUc.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseUc.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/CheckTheDatabaseUc.html (revision 0) @@ -0,0 +1,23 @@ + + + + + + + Template: Check the database UC + + + +
+
    +
  1. + + +
  2. +
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/CleanUpManager.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/CleanUpManager.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/CleanUpManager.html (revision 0) @@ -0,0 +1,44 @@ + + + + + + + Template: Clean up manager + + + +
+
+ ###NUMBERCACHED### +
+
+ ###NUMBER### +
+
+
+
+
    +
  1. + + +
  2. +
+
+
+
    +
  1. + +
  2. +
+
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/DisplayFieldComp.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/DisplayFieldComp.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/DisplayFieldComp.html (revision 0) @@ -0,0 +1,45 @@ + + + + + + + Template: Display fields compare + + + + + + + + + + + + + + + + + + + + +
+ ###HEADERFIELDNAME### + + ###HEADERSUGGESTED### + + ###HEADERACTUAL### +
+ ###FIELDNAME### + + ###FIELDCONTENT### + + ###FIELDCONTENTDB### +
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/DisplayFields.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/DisplayFields.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/DisplayFields.html (revision 0) @@ -0,0 +1,39 @@ + + + + + + + Template: Display fields + + + + + + + + + + + + + + + + + + +
+ ###HEADERFIELDNAME### + + ###HEADERLABEL### +
+ ###FIELDNAME### + + ###FIELDCONTENT### +
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/DisplaySuggestions.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/DisplaySuggestions.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/DisplaySuggestions.html (revision 0) @@ -0,0 +1,53 @@ + + + + + + + Template: Display suggestions + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ###HEADERFIELDNAME### + + ###HEADERLABEL### +
+ ###HEADERSUGGESTION### +
+ + ###CODE### + +
+ ###FIELDNAME### + + ###FIELDCONTENT### +
+ + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/DisplayTwinImage.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/DisplayTwinImage.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/DisplayTwinImage.html (revision 0) @@ -0,0 +1,112 @@ + + + + + + + Template: Display twin image + + + + + + + + + + + +
+ Your server + + Reference +
+ + + + + + + + + + + + + +
+ ###YOURSERVER### + + ###REFERENCE### +
+ ###YOURSERVERINFORMATION### + + ###REFERENCEINFORMATION### +
+ + + + + + + + + + + + + +
+ ###MESSAGE### +
+ ###YOURSERVERFILESIZE### + + ###REFERENCEFILESIZE### +
+ + +

###MESSAGE###

+ + +

+ + ###MESSAGE### + +
+ ###LABEL### +

+ + +

+ ###MESSAGE### +

+
+
+
+ +
+
+
+ + + +

+ ###MESSAGE### +
+ ###LABEL### +

+ +
+
+
+ +
+
+
+ + + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/GenerateConfigForm.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/GenerateConfigForm.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/GenerateConfigForm.html (revision 0) @@ -0,0 +1,41 @@ + + + + + + + Template: Generate config form + + + +
+
    +
  1. + ###DESCRIPTION### +
  2. + +
  3. + + +
  4. + + +
  5. + + + +
  6. + + +
  7. + + +
  8. + +
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/GenerateUpdateDatabaseFormCheckboxes.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/GenerateUpdateDatabaseFormCheckboxes.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/GenerateUpdateDatabaseFormCheckboxes.html (revision 0) @@ -0,0 +1,49 @@ + + + + + + + Template: Generate Update Database Form Checkboxes + + + +
+ ###LABEL### +
    + +
  1. + + +
  2. + + +
  3. + + +
  4. + + + +
  5. + ###WARNING### +
  6. + + +
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/GetUpdateDbFormWrap.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/GetUpdateDbFormWrap.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/GetUpdateDbFormWrap.html (revision 0) @@ -0,0 +1,35 @@ + + + + + + + Template: Generate update database form wrap + + + +
+
+
    + +
+
+ ###CONTENT### +
+
    +
  1. + +
  2. +
+
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/ImageMenu.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/ImageMenu.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/ImageMenu.html (revision 0) @@ -0,0 +1,24 @@ + + + + + + + Template: Image menu + + + +
    + +
  1. + + ###ITEM### + +
  2. + +
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/InitExtConfig.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/InitExtConfig.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/InitExtConfig.html (revision 0) @@ -0,0 +1,32 @@ + + + + + + + Template: Init ext config + + + +
+ ###CONTENT### +
+
    +
  1. + +
  2. +
  3. + ###NOTICE### + ###EXPLANATION### +
  4. +
+
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/Install.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/Install.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/Install.html (revision 0) @@ -0,0 +1,70 @@ + + + + + + + ###HEADTITLE### + ###JAVASCRIPT### + ###STYLESHEETS### + + +
###CONTENTBEFORETABLE###
+
+

###TITLE###

+

###HEADTITLE###

+
+ + + + + + +
+ + +
+ + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/Install_123.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/Install_123.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/Install_123.html (revision 0) @@ -0,0 +1,40 @@ + + + + + + + ###HEADTITLE### + ###JAVASCRIPT### + ###STYLESHEETS### + + +
###CONTENTBEFORETABLE###
+
+

###TITLE###

+
 
+

###HEADTITLE###

+
+ + + + + +
+
 
+ +
+ + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/Install_login.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/Install_login.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/Install_login.html (revision 0) @@ -0,0 +1,20 @@ + + + + + + + ###HEADTITLE### + ###JAVASCRIPT### + ###STYLESHEETS### + + + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/LoginForm.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/LoginForm.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/LoginForm.html (revision 0) @@ -0,0 +1,62 @@ + + + + + + + Template: Login Form + + + +
 
+

###HEADTITLE###

+
+

###SITENAME###

+
+
+
    +
  1. + + +
  2. + +
+
+
+
    +
  1. + +
  2. +
+
+
+
+
 
+ +

+ ###PASSWORDMESSAGE### +
+ ###PASSWORD### +

+ + +

+ ###MESSAGE### +

+ + ###MESSAGE### + + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/PhpInformation.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/PhpInformation.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/PhpInformation.html (revision 0) @@ -0,0 +1,25 @@ + + + + + + + Template: PHP information + + + +

+ ###EXPLANATION### +

+
+
+
+ +
+
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/PrintAll.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/PrintAll.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/PrintAll.html (revision 0) @@ -0,0 +1,23 @@ + + + + + + + Template: Print All + + +
+
+ + +

###HEADER###

+ ###SECTIONCONTENT### + + +
+
+ + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/PrintSection.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/PrintSection.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/PrintSection.html (revision 0) @@ -0,0 +1,19 @@ + + + + + + + Template: Print Section + + + +

###SHORTSTRING###

+ + ###LONGSTRING### + + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/SetupGeneral.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/SetupGeneral.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/SetupGeneral.html (revision 0) @@ -0,0 +1,257 @@ + + + + + + + Template: Setup General + + + +
+ +
+
    +
  1. + + +
  2. + +
  3. + ###LABELSQLSAFEMODEUSER### +
    + + ###SQLSAFEMODEUSER### + +
  4. + +
  5. + + +
  6. +
  7. + + +
  8. +
+
+ +
+
    + +
  1. + + +
  2. +
  3. + + +
  4. + + +
  5. + + + ###TYPO3DB### + +
    + ###LABELNODATABASE### + +
  6. + +
+
+ + + +
+
    +
  1. + + +
  2. +
+
+
+
    +
  1. + + + +
    + +
    +
  2. +
+
+ +
+
    +
  1. + + + ###STRONGDISABLEEXECFUNCTION### +
    + ###LABELCURRENTVALUEIS### ###DEFAULTDISABLEEXECFUNCTION### + +
    +
  2. +
+
+ + +
+
    +
  1. + + + ###STRONGGDLIB### +
    + ###LABELCURRENTVALUEIS### ###DEFAULTGDLIB### + +
    +
  2. +
+
+ + +
+
    +
  1. + + + ###STRONGGDLIBPNG### +
    + ###LABELCURRENTVALUEIS### ###DEFAULTGDLIBPNG### +
    + +
    +
  2. +
+
+ + +
+
    +
  1. + + + ###STRONGIMAGEMAGICK### +
    + ###LABELCURRENTVALUEIS### ###DEFAULTIMAGEMAGICK### + +
    +
  2. +
+
+ + +
+
    +
  1. + + + ###STRONGIMCOMBINEFILENAME### +
    + ###LABELCURRENTVALUEIS### ###DEFAULTIMCOMBINEFILENAME### + +
    +
  2. +
+
+ + +
+
    +
  1. + + + ###STRONGIMVERSION5### +
    + ###LABELCURRENTVALUEIS### ###DEFAULTIMVERSION5### + +
    +
  2. +
+
+ + +
+
    +
  1. + + + ###STRONGIMPATH### +
    + ###LABELCURRENTVALUEIS### ###DEFAULTIMPATH### + +
    +
  2. +
+
+ + +
+
    +
  1. + + + ###STRONGIMPATHLZW### +
    + ###LABELCURRENTVALUEIS### ###DEFAULTIMPATH### +
    + +
    +
  2. +
+
+ + +
+
    +
  1. + + +
  2. +
+
+ + +
+
    +
  1. + +
  2. +
  3. + ###LABELNOTICE### + ###LABELCOMMENTUPDATELOCALCONF### +
  4. +
+
+
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/StepHeader.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/StepHeader.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/StepHeader.html (revision 0) @@ -0,0 +1,24 @@ + + + + + + + Template: Step Header + + + +
    + +
  1. + + ###STEP### + +
  2. + +
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/StepOutput.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/StepOutput.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/StepOutput.html (revision 0) @@ -0,0 +1,162 @@ + + + + + + + Template: Step Output + + + + ###STEPHEADER### +

###HEADER###

+ ###STEP### + + + + + ###LLINTRODUCTION### +
+
+
    + +
+
+
+
    +
  1. + +
  2. +
+
+
+ + + +
+
+
    + +
  1. + + +
  2. +
  3. + + +
  4. +
  5. + + +
  6. +
+
+
+
    +
  1. + +
  2. +
+
+
+ + + +

###LLOPTIONS###

+
+
+
    + +
  1. + +

    ###LLREMARK1###

    + +
  2. +
  3. + +

    ###LLREMARK2###

    + +
  4. +
+
+
+
    +
  1. + +
  2. +
+
+
+ + + +

###LLSUMMARY###

+
+
###LLUSERNAME###
+
###USERNAME###
+
###LLHOST###
+
###HOST###
+
###LLDATABASE###
+
###DATABASE###
+
###LLNUMBERTABLES###
+
###NUMBERTABLES###
+
+
+
+
    + +
  1. + + +
  2. +
+
+
+
    +
  1. + +
  2. +
+
+
+ + + + ###MESSAGEBASICFINISHED### +

###LLIMPORTANT###

+ ###SECURITYRISK### + ###LLSWITCHMODE### + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/Typo3ConfEdit.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/Typo3ConfEdit.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/Typo3ConfEdit.html (revision 0) @@ -0,0 +1,101 @@ + + + + + + + Template: TYPO3 Conf Edit + + + +
+ +
+ + ###FILENAME### + +
+
+ ###FILESIZE### +
+ +
+

+ ###EDITPATH### +

+ +
+
+
    +
  1. + + +
  2. +
+
+
+
    +
  1. + +
  2. +
+
+
+ +

+ + ###DELETETEMPCACHED### + +

+ +

+ ###LLEDITING### ###FILE### +

+ ###MESSAGES### +

+ ###MD5SUM### +

+
+
+
    + +
  1. + +
  2. +
+
+
+
    +
  1. + + +
  2. +
  3. + + +
  4. +
+
+
+
    +
  1. + + + + +
  2. +
+
+
+ + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/Typo3TempManager.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/Typo3TempManager.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/Typo3TempManager.html (revision 0) @@ -0,0 +1,73 @@ + + + + + + + Template: TYPO3 Temp Manager + + + +
+
+ ###NUMBERTEMPORARY### +
+
+ ###TEMPORARY### +
+
+ ###NUMBERMATCHING### +
+
+ ###MATCHING### ###DELETETYPE### +
+
+ ###NUMBERDELETED### +
+
+ ###DELETED### +
+
+
+
+
    +
  1. + + +
  2. +
  3. + + +
  4. +
  5. + + +
  6. +
+
+
+
    +
  1. + +
  2. +
+
+
+ ###EXPLANATION### + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/UpdateWizardParts.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/UpdateWizardParts.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/UpdateWizardParts.html (revision 0) @@ -0,0 +1,140 @@ + + + + + + + Template: Update wizard parts + + + + + +
+ + +

###IDENTIFIER###

+ ###EXPLANATION### +
+
    +
  1. + +
  2. +
+
+ +
+ +

###FINALSTEP###

+ ###FINALSTEPEXPLANATION### + ###COMPAREDATABASE###  + + + + +
+ +

+ + ###INTRODUCTION### + +

+ +

+ + ###NOUPDATES### + +

+ + +
+
    + +
+
+

+ + ###IDENTIFIER### + +

+ ###IDENTIFIERMETHOD### + +
+
    +
  1. + + +
  2. +
+
+
+
    +
  1. + +
  2. +
+
+
+ + + + +

+ + ###IDENTIFIER### + +

+ + ###CUSTOMOUTPUT### +
+
+ + ###GOBACK### + + + + + ###UPDATESTATUS### + + +
+ ###QUERY### + + + +
+ ###CUSTOM### + + + + + + ###NOUPDATEMETHOD### + + + + + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/ViewArray.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/ViewArray.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/ViewArray.html (revision 0) @@ -0,0 +1,25 @@ + + + + + + + Template: View Array + + + +
+ +
+ ###KEY### +
+
+ ###DESCRIPTION### +
+ +
+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Private/Templates/WriteToLocalConfControl.html =================================================================== --- typo3/sysext/install/Resources/Private/Templates/WriteToLocalConfControl.html (revision 0) +++ typo3/sysext/install/Resources/Private/Templates/WriteToLocalConfControl.html (revision 0) @@ -0,0 +1,37 @@ + + + + + + + Template: Write to localconf control + + + +

###HEADER###

+
    + +
  • + ###MESSAGE### +
  • + +
+

+ + ###LABEL### + +

+ + +

###HEADER###

+

###MESSAGE###

+

+ + ###LABEL### + +

+ + + \ No newline at end of file Index: typo3/sysext/install/Resources/Public/Images/body-background.jpg =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\body-background.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/button-background.jpg =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\button-background.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/content-background.jpg =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\content-background.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/content-bottom.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\content-bottom.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/content-top.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\content-top.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/input-background.gif =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\input-background.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/login-icon-key.gif =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\login-icon-key.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/logo.gif =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\logo.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuAbout.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuAbout.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuBackground.gif =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuBackground.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuCleanup.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuCleanup.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuConfig.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuConfig.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuDatabase.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuDatabase.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuExtConfig.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuExtConfig.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuImages.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuImages.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuPhpinfo.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuPhpinfo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuTypo3confEdit.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuTypo3confEdit.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuTypo3temp.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuTypo3temp.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/menuUpdate.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\menuUpdate.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Images/numbers.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: typo3\sysext\install\Resources\Public\Images\numbers.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: typo3/sysext/install/Resources/Public/Javascript/install.js =================================================================== --- typo3/sysext/install/Resources/Public/Javascript/install.js (revision 0) +++ typo3/sysext/install/Resources/Public/Javascript/install.js (revision 0) @@ -0,0 +1,49 @@ +/*************************************************************** +* +* Javascript functions to provide AJAX calls for install tool +* +* Copyright notice +* +* (c) 2009 Marcus Krause, Helmut Hummel +* All rights reserved +* +* This script is part of the TYPO3 backend provided by +* Kasper Skaarhoj together with TYPO3 +* +* Released under GNU/GPL (see license file in /typo3/) +* +* 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. +* +* This copyright notice MUST APPEAR in all copies of this script +* +***************************************************************/ + + +/** + * + * @author Marcus Krause + */ +var EncryptionKey = { + thisScript: '../../index.php', + eID: 'tx_install_ajax', + cmd: 'encryptionKey', + + // loads the ecryption key by an AJAX call + load: function(obj) { + // fallback if AJAX is not possible (e.g. IE < 6) + if (typeof Ajax.getTransport() != 'object') { + window.location.href = this.thisScript + '?eID=' + this.eID + '&cmd=' + this.cmd; + return; + } + + new Ajax.Request(this.thisScript, { + method: 'get', + parameters: '?eID=' + this.eID + '&cmd=' + this.cmd, + onComplete: function(xhr) { + document.getElementsByName('TYPO3_INSTALL[localconf.php][encryptionKey]').item(0).value=xhr.responseText; + }.bind(this) + }); + } +}; Index: typo3/sysext/install/Resources/Public/Stylesheets/general.css =================================================================== --- typo3/sysext/install/Resources/Public/Stylesheets/general.css (revision 0) +++ typo3/sysext/install/Resources/Public/Stylesheets/general.css (revision 0) @@ -0,0 +1,342 @@ +@CHARSET "UTF-8"; + +/* Font size 62.8% = 1em = 10px */ +body { + font: 62.8% Verdana, Arial, Helvetica, sans-serif; +} + +p, form, fieldset, h3, h4, h5, h6, dl { + margin: 1em 0 1em 0; +} + +ol, ul { + margin: 1em 0 1em 1.5em; + padding: 0 0 0 1em; +} + +ul { + list-style:disc; +} + +ol { + list-style: decimal; +} + +h2 { + margin: 2.5em 0 1.7em 0.8em; + color: #585858; + font-size: 120%; + font-weight: bold; +} + +h3 { + font-size: 120%; + margin: 0.7em 0 1.5em +} + +.clearfix:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +* html .clearfix { + height: 1%; +} + +legend { + margin-left: 1em; + font-weight: bold; +} + +fieldset ol { + margin: 0; + padding: 0; + list-style: none; +} + +fieldset li { + margin-bottom: 0.5em; + float: left; + clear: left; + width: 100%; +} + +label { + float: left; + width: 18em; + margin-right: 1em; + padding: 0.2em 0; +} + +fieldset span { + float: left; + width: 29em; +} + +.labelAfter input { + float: left; +} + +.labelAfter label, +.labelAbove label { + float: none; + display: block; + width: auto; + margin-right: 0; +} + +.labelAbove label { + margin-bottom: 0.5em; +} + +.labelAfter label { + padding-left: 3em; +} + +.labelWidth7 label { + width: 7em; +} + +.labelWidth21 label { + width: 21em; +} + +fieldset.submit { + float: none; + width: auto; +} + +fieldset select, +input.inputText, +textarea { + background: url('../Images/input-background.gif') repeat-x scroll 0 0 #FFFFFF; + border: 1px solid #7C7C7C; + color: #000000; + font-size: 1.1em; + line-height: 1.7em; + margin: 0; + width: 14.7em; +} + +fieldset select { + height: 2em; + padding: 0.2em; + width: 17.4em; +} + +input.inputText { + height: 1.7em; + padding: 0.1em 2.1em 0 0.45em; +} + +textarea { + width: 99%; + font-size: 1.2em; +} + +button { + color: #606060; + font-size: 1.1em; + padding: 0.3em 0.6em; + border: 1px solid #7c7c7c; + background: #f6f6f6 url('../Images/button-background.jpg') repeat-x left bottom; + cursor: pointer; +} + +button span { + background-repeat: no-repeat; + display: inline-block; + width: 16px; + height: 16px; + margin-left: 0.6em; + float: none; +} + +button span.negative { + background-image: url('../../../../../gfx/error.png'); +} + +button span.positive { + background-image: url('../../../../../gfx/ok.png'); +} + +.hidden { + display: none; +} + +.strong { + font-weight: bold; +} + +#container { + width: 76em; + margin: 1em auto; +} + +#left { + float: left; + width: 19em; + clear: both; +} + +#right { + padding-left: 19em; + width: 57em; +} + +#menu { + margin: 0; + padding: 0.5em 0; + list-style: none; + width: 16em; + font-size: 110%; + line-height: 2em; +} + +#menu li { + padding: 0 0 0 2.8em; +} + +#menu li.act { + background-color: #585858; +} + +#menu a { + color: #606060; + text-decoration: none; +} + +#menu a:hover { + text-decoration: underline; +} + +#menu li.act a { + font-weight: bold; + color: #ffffff; +} + +#menu li { + background-repeat: no-repeat; + background-position: 0.7em center; +} + +#menu #config { + background-image: url('../Images/menuConfig.png'); +} + +#menu #database { + background-image: url('../Images/menuDatabase.png'); +} + +#menu #update { + background-image: url('../Images/menuUpdate.png'); +} + +#menu #images { + background-image: url('../Images/menuImages.png'); +} + +#menu #extConfig { + background-image: url('../Images/menuExtConfig.png'); +} + +#menu #typo3temp { + background-image: url('../Images/menuTypo3temp.png'); +} + +#menu #cleanup { + background-image: url('../Images/menuCleanup.png'); +} + +#menu #phpinfo { + background-image: url('../Images/menuPhpinfo.png'); +} + +#menu #typo3conf_edit { + background-image: url('../Images/menuTypo3confEdit.png'); +} + +#menu #about { + background-image: url('../Images/menuAbout.png'); +} + +#links { + margin: 2em 0 0 0.8em; + padding: 0; + list-style: none; + width: 15.2em; + font-size: 110%; + line-height: 2em; +} + +#links a { + color: #797878; + text-decoration: none; +} + +#links a:hover { + text-decoration: underline; +} + +#content { + font-size: 110%; + line-height: 1.5em; + padding: 0.1em 1.8em 1em 1.8em; + color: #606060; +} + +.typo3-message { + padding: 0.6em 0.6em 0.6em 2.6em; + background-repeat: no-repeat; + background-position: 0.5em 0.7em; + border: 1px solid; + color: #000000; +} + +.typo3-message h4 { + margin-top: 0; +} + +.message-notice { + background-image: url("../../../../../gfx/notice.png"); + background-color: #f6f7fa; + border-color: #c2cbcf; +} + +.message-information { + background-image: url("../../../../../gfx/information.png"); + background-color: #ddeef9; + border-color: #8aafc4; +} + +.message-ok { + background-image: url("../../../../../gfx/ok.png"); + background-color: #cdeaca; + border-color: #58b548; +} + +.message-warning { + background-image: url("../../../../../gfx/warning.png"); + background-color: #fbffb3; + border-color: #c4b70d; +} + +.message-error { + background-image: url("../../../../../gfx/error.png"); + background-color: #fbb19b; + border-color: #dc4c42; +} + +#copyright { + color: #797878; + border-top: 1px #5f5f5f solid; + margin-top: 3.7em; + clear: both; +} + +#copyright a { + color: #797878; +} \ No newline at end of file Index: typo3/sysext/install/Resources/Public/Stylesheets/install.css =================================================================== --- typo3/sysext/install/Resources/Public/Stylesheets/install.css (revision 0) +++ typo3/sysext/install/Resources/Public/Stylesheets/install.css (revision 0) @@ -0,0 +1,385 @@ +@CHARSET "UTF-8"; + +body { + background-color: #f2f2f2; +} + +h1, +#menuTop, +#menuBottom, +#links, +#contentTop, +#contentBottom, +#copyright { + display: none; +} + +#content, +#menu { + border: 1px #dcdcdc solid; + background-color: #ffffff; +} + +/* 0: Login form */ + +/* 1: Basic configuration */ +#checkImageMagick label { + width: 27em; +} + +#systemInformation dt { + float: left; + width: 11em; +} + +#systemInformation dd { + padding-left: 11em; + font-weight: bold; +} + +#imageMagickVersions td { + padding-right: 1em; +} + +/* 2: Database Analyzer */ +#databaseMenu { + width: 100%; +} + +#databaseConnected dt, +#checkTheDatabaseExplanation dt { + float: left; + width: 7em; +} + +#databaseConnected dd, +#checkTheDatabaseExplanation dd { + padding-left: 7em; +} + +#databaseConnected dd, +#checkTheDatabaseExplanation dt { + font-weight: bold; +} + +#checkTheDatabaseImport label span, +#checkTheDatabaseCache label span { + float: none; + display: inline-block; + vertical-align: top; +} + +#checkTheDatabaseImport label span { + width: 32%; +} + +#checkTheDatabaseCache label span.column1 { + width: 27%; +} +#checkTheDatabaseCache label span.column3 { + width: 56%; +} + +#checkTheDatabaseCache label span.column2 { + width: 15%; +} + +.displayFields, +.displaySuggestions, +.displayFieldsCompare { + width: 100%; + margin-bottom: 1em; +} + +.displayFields th, +.displaySuggestions th, +.displayFieldsCompare th { + text-align: left; + background-color: #B3B7BD; +} + +.displaySuggestions .tfootHeader { + font-weight: bold; + background-color: #d0d0d0; +} + +.displayFields th, +.displayFields td, +.displaySuggestions th, +.displaySuggestions td, +.displayFieldsCompare th, +.displayFieldsCompare td { + padding: 0.2em; +} + +.displayFields thead, +.displayFields tbody, +.displaySuggestions thead, +.displaySuggestions tfoot, +.displaySuggestions tbody, +.displayFieldsCompare thead, +.displayFieldsCompare tbody { + border: 1px #B3B7BD solid; +} + +.displayFields .column1, +.displaySuggestions .column1 { + width: 35%; +} + +.displaySuggestions tr { + border-top: 1px #B3B7BD solid; +} + +.displaySuggestions pre { + font-size: 110%; +} + +.displayFieldsCompare .warning { + color: red; +} + +/* 4: Image processing */ +#imageProcessingIm dt, +#imageProcessingOther dt, +#imageProcessingFileFormats dt { + float: left; + width: 19em; +} + +#imageProcessingIm dd, +#imageProcessingOther dd, +#imageProcessingFileFormats dd { + font-weight: bold; + padding-left: 19em; +} + +#imageProcessingIm dd span, +#imageProcessingOther dd span, +#imageProcessingFileFormats dd span { + font-weight: normal; +} + +.displayTwinImageTextarea { + width: 48em; + overflow: scroll; + border: 1px #797878 solid; +} + +.displayTwinImageTextarea textarea { + width: 300em; + border: 0; +} + +.displayTwinImageImages, +.displayTwinImageReference, +.displayTwinImageDifferentFileSize { + width: 100%; + margin: 0.3em 0; +} + +.displayTwinImageImages td, +.displayTwinImageReference th, +.displayTwinImageReference td, +.displayTwinImageDifferentFileSize th, +.displayTwinImageDifferentFileSize td { + text-align: center; +} + +/* 5: All configuration */ + +/* 6: typo3temp/ */ +#tempManagerNumbers dt { + float: left; + width: 19em; +} + +#tempManagerNumbers dd { + font-weight: bold; + padding-left: 19em; +} + +#tempManagerNumbers dd span { + font-weight: normal; +} + +/* 7: Clean up database */ +#cleanupManagerNumbers dt { + float: left; + width: 19em; +} + +#cleanupManagerNumbers dd { + font-weight: bold; + padding-left: 19em; +} + +#cleanupManagerNumbers dd span { + font-weight: normal; +} + +/* 8: phpinfo() */ +#debugInformation { + width: 48em; + height: 20em; + overflow: scroll; + border: 1px #797878 solid; +} + +#debugInformation textarea { + width: 200em; + height: 68em; + border: 0; +} + +.viewArray { + border: 1px solid #B3B7BD; + border-bottom: 0; +} + +.viewArray .viewArray { + border: 0; +} + +.viewArray dt { + float: left; + width: 19em; + font-weight: bold; +} + +.viewArray dd { + padding-left: 19em; + border-bottom: 1px #d0d0d0 solid +} + +.viewArray .viewArray dt { + width: 10em; +} + +.viewArray .viewArray dd { + padding-left: 10em; + border: 0; +} + +.viewArray dl { + margin: 0; +} + +.phpinfo pre { + margin: 0px; + font-family: monospace; +} + +.phpinfo table { + border-collapse: collapse; + width: 100%; + table-layout: fixed; +} + +.phpinfo .center table { + margin-left: auto; + margin-right: auto; + text-align: left; +} + +.phpinfo .center th { + text-align: center !important; +} + +.phpinfo td, +.phpinfo th { + border: 1px solid #000000; + vertical-align: baseline; + padding: 0.3em; + overflow: hidden; +} + +.phpinfo h1 { + font-size: 150%; + background-image: none; + text-indent: 0; + height: auto; + color: #000000; + margin: 1em 0 1em 0; + text-align: center; + float: none; +} + +.phpinfo h2 { + margin: 1em 0 1em 0; + color: #000000; + padding: 0; + text-align: center; + background-color: transparent; + float: none; +} + +.phpinfo .p { + text-align: left; +} + +.phpinfo .e { + background-color: #ccf; + font-weight: bold; + color: #000000; +} + +.phpinfo .h { + background-color: #99c; + font-weight: bold; + color: #000000; +} + +.phpinfo .v { + background-color: #ccc; + color: #000000; +} + +.phpinfo .vr { + background-color: #ccc; + text-align: right; + color: #000000; +} + +.phpinfo img { + float: right; + border: 0px; +} + +.phpinfo hr { + background-color: #ccc; + border: 0px; + height: 1px; + color: #000000; +} + +/* 9: Edit files in typo3conf/ */ +#confEditFileList dt { + float: left; + width: 45em; +} + +#confEditFileList dd { + padding-left: 45em; +} + +#confEditFileList dt a { + color: blue; + text-decoration: none; +} + +#confEditFileList dt a:hover { + text-decoration: underline; +} + +#confEditFileList dt.act a { + font-weight: bold; +} + +#fileEdit textarea { + height: 10em; + width: 99%; + padding: 0; +} + +/* 10: About */ \ No newline at end of file Index: typo3/sysext/install/Resources/Public/Stylesheets/install_123.css =================================================================== --- typo3/sysext/install/Resources/Public/Stylesheets/install_123.css (revision 0) +++ typo3/sysext/install/Resources/Public/Stylesheets/install_123.css (revision 0) @@ -0,0 +1,201 @@ +@CHARSET "UTF-8"; + +/* Font size 62.8% = 1em = 10px */ +body { + background: #4f4f4f url('../Images/body-background.jpg') repeat-x fixed; +} + +#container { + width: 43em; + margin-left: 16em; +} + +h1 { + background: url('../Images/logo.gif') no-repeat scroll 0 0 transparent; + text-indent:-999em; + margin: 2em 0 3.7em 0; + height: 34px; +} + +h2 { + background-color: #585858; + font-size: 120%; + font-weight: bold; + color: #ffffff; + padding: 0.5em 1.8em 0.5em 1.8em; + margin: 0; +} + +h3 { + font-size: 163%; +} + +#contentTop { + height: 3px; + background: #3e3e3e url('../Images/content-top.png') no-repeat center bottom; +} + +#contentBottom { + height: 3px; + background: #4d4c4d url('../Images/content-bottom.png') no-repeat center top; +} + +#content { + color: #787878; + background: #ebebeb url('../Images/content-background.jpg') repeat-x left bottom; + padding: 1em 1.8em 1em; +} + +/* 1-2-3 General */ +#stepHeader { + list-style: none; + margin: 1em 0 0; + padding: 0; +} + +#stepHeader li { + float: left; + text-indent:-999em; + width: 35px; + height: 35px; + margin-right: 1.1em; + background: url('../Images/numbers.png') no-repeat scroll 0 0 transparent; +} + +#stepHeader li a { + width: 100%; + height: 100%; + display: block; +} + +#stepHeader li.step1 { + background-position: 0 0; +} + +#stepHeader li.step1.act { + background-position: 0 center; +} + +#stepHeader li.step1.done { + background-position: 0 bottom; +} + +#stepHeader li.step2 { + background-position: -35px 0; +} + +#stepHeader li.step2.act { + background-position: -35px center; +} + +#stepHeader li.step2.done { + background-position: -35px bottom; +} + +#stepHeader li.step3 { + background-position: -70px 0; +} + +#stepHeader li.step3.act { + background-position: -70px center; +} + +#stepHeader li.step3.done { + background-position: -70px bottom; +} + +#stepHeader li.step4 { + background-position: -105px 0; +} + +#stepHeader li.step4.act { + background-position: -105px center; +} + +#stepHeader li.step4.done { + background-position: -105px bottom; +} + +#stepHeader li.step5 { + background-position: -140px 0; +} + +#stepHeader li.step5.act { + background-position: -140px center; +} + +#stepHeader li.step5.done { + background-position: -140px bottom; +} + +#stepHeader li.step6 { + background-position: -175px 0; +} + +#stepHeader li.step6.act { + background-position: -175px center; +} + +#stepHeader li.step6.done { + background-position: -175px bottom; +} + +#stepHeader li.step7 { + background-position: -210px 0; +} + +#stepHeader li.step7.act { + background-position: -210px center; +} + +#stepHeader li.step7.done { + background-position: -210px bottom; +} + +#stepHeader li.step8 { + background-position: -245px 0; +} + +#stepHeader li.step8.act { + background-position: -245px center; +} + +#stepHeader li.step8.done { + background-position: -245px bottom; +} + +#skip123 { + text-align: right; + font-size: 0.91em; +} + +#skip123 a { + color: #888888; + text-decoration: none; +} + +#skip123 a:hover { + text-decoration: underline; +} + +/* 1-2-3: Step 3 */ +#step3 label { + float: none; + font-weight: bold; +} + +#step3 p { + margin: 0 0 0.5em; +} + +/* 1-2-3: Step 4 */ +#stepOutputSummary dt { + float: left; + clear: both; + width: 15em; + margin-right: 1em; +} + +#stepOutputSummary dd { + float: left; +} \ No newline at end of file Index: typo3/sysext/install/Resources/Public/Stylesheets/install_login.css =================================================================== --- typo3/sysext/install/Resources/Public/Stylesheets/install_login.css (revision 0) +++ typo3/sysext/install/Resources/Public/Stylesheets/install_login.css (revision 0) @@ -0,0 +1,49 @@ +@CHARSET "UTF-8"; + +body { + background-color: #f2f2f2; +} + +#container { + width: 43em; + margin: 1em auto; +} + +h1, +#contentTop, +#contentBottom { + display: none; +} + +.login h1 { + float: none; +} + +.login h2 { + background: url('../Images/login-icon-key.gif') no-repeat scroll 1em center #585858; + color: #ffffff; + font-size: 120%; + padding:0.5em 0 0.5em 3.35em; + margin: 0; +} + +h3 { + margin: 1em 0 2em 0; +} + +#content { + border: 1px #dcdcdc solid; + border-top: 0; + color: #606060; + background-color: #eeeeee; + padding: 1em 3.6em 1em; +} + +.typo3-message { + font-size: 110%; + line-height: 1.5em; +} + +.message-information { + color: #64859c; +} \ No newline at end of file Index: typo3/sysext/install/Resources/Public/Stylesheets/install_standalone.css =================================================================== --- typo3/sysext/install/Resources/Public/Stylesheets/install_standalone.css (revision 0) +++ typo3/sysext/install/Resources/Public/Stylesheets/install_standalone.css (revision 0) @@ -0,0 +1,70 @@ +@CHARSET "UTF-8"; + +body { + background: #4f4f4f url('../Images/body-background.jpg') repeat-x fixed; +} + +#container { + margin: 0 auto; +} + +h1, +#menuTop, +#menuBottom, +#links, +#contentTop, +#contentBottom, +#copyright { + display: block; +} + +h1 { + background: url('../Images/logo.gif') no-repeat scroll 0 0 transparent; + text-indent:-999em; + margin: 2em 0 3.7em 0; + height: 34px; + width: 19em; + float: left; +} + +h2 { + padding: 3.3em 0 3.7em 17.5em; + margin: 0; + height: auto; + color: #ffffff; +} + +#contentTop { + height: 3px; + background: #3e3e3e url('../Images/content-top.png') no-repeat center bottom; +} + +#content { + background-color: #eeeeee; +} + +#contentBottom { + height: 3px; + background: #4d4c4d url('../Images/content-bottom.png') no-repeat center top; +} + +#menu, +#content { + border: 0; +} + +#menuTop { + width: 17.6em; + height: 3px; + background: #3e3e3e url('../Images/content-top.png') no-repeat center bottom; +} + +#menu { + background: #ebebeb url('../Images/menuBackground.gif') repeat-x left bottom; +} + +#menuBottom { + width: 17.6em; + height: 3px; + background: #3e3e3e url('../Images/content-top.png') no-repeat center bottom; +} \ No newline at end of file Index: typo3/sysext/install/Resources/Public/Stylesheets/reset.css =================================================================== --- typo3/sysext/install/Resources/Public/Stylesheets/reset.css (revision 0) +++ typo3/sysext/install/Resources/Public/Stylesheets/reset.css (revision 0) @@ -0,0 +1,55 @@ +@CHARSET "UTF-8"; + +/* http://meyerweb.com/eric/tools/css/reset/ */ +/* v1.0 | 20080212 */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-size: 100%; + vertical-align: baseline; + background: transparent; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} + +/* remember to define focus styles! */ +:focus { + outline: 0; +} + +/* remember to highlight inserts somehow! */ +ins { + text-decoration: none; +} +del { + text-decoration: line-through; +} + +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: collapse; + border-spacing: 0; +} \ No newline at end of file Index: typo3/sysext/install/updates/class.tx_coreupdates_compatversion.php =================================================================== --- typo3/sysext/install/updates/class.tx_coreupdates_compatversion.php (revision 7289) +++ typo3/sysext/install/updates/class.tx_coreupdates_compatversion.php (working copy) @@ -52,21 +52,63 @@ global $TYPO3_CONF_VARS; if ($this->compatVersionIsCurrent()) { - $description = 'Up to date!
If you do not use the wizard, your current TYPO3 installation is configured to use all the features included in the current release '.TYPO3_version.'.
- There are two possibilities that you see this screen:
  1. You just updated from a previous version of TYPO3: - Because of some new features, the frontend output of your site might have changed. To emulate the "old" frontend behavior, change the compatibility version by continuing to step 2. - This is recommended after every update to make sure the frontend output is not altered. When re-running the wizard, you will see the changes needed for using the new features. - Please continue to step two.
  2. -
  3. You just made a fresh install of TYPO3: - Perfect! All new features will be used. - You can stop here and do not need this wizard now.
'; + $description = ' +

+ Up to date! +
+ If you do not use the wizard, your current TYPO3 + installation is configured to use all the features included + in the current release ' . TYPO3_version . '. +
+ There are two possibilities that you see this screen: +

+
    +
  1. + You just updated from a previous version of + TYPO3: + Because of some new features, the frontend output of + your site might have changed. To emulate the "old" + frontend behavior, change the compatibility version + by continuing to step 2. + This is recommended after every update + to make sure the frontend output is not altered. When + re-running the wizard, you will see the changes needed + for using the new features. + Please continue to step two. +
  2. +
  3. + You just made a fresh install of TYPO3: + Perfect! All new features will be used. + You can stop here and do not need this wizard now. +
  4. +
+ '; if (!$TYPO3_CONF_VARS['SYS']['compat_version']) { $description .= ' - The compatibility version has been set to the current TYPO3 version. This is a stamp and has no impact for your installation.'; +

+ The compatibility version has been set to the current + TYPO3 version. This is a stamp and has no impact for + your installation. +

+ '; } } else { - $description = 'Your current TYPO3 installation is configured to behave like version '.$TYPO3_CONF_VARS['SYS']['compat_version'].' of TYPO3. If you just upgraded from this version, you most likely want to use new features as well.

In the next step, you will see the things that need to be adjusted to make your installation compatible with the new features.'; + $description = ' +

+ Your current TYPO3 installation is configured to + behave like version + ' . $TYPO3_CONF_VARS['SYS']['compat_version'] . ' + of TYPO3. If you just upgraded from this version, + you most likely want to use new features as + well. +

+

+ In the next step, you will see the things that need to be + adjusted to make your installation compatible with the new + features. +

+ '; } return 1; // Return 1 in any case so user has possibility to switch back to a previous compat_version. @@ -81,24 +123,64 @@ function getUserInput($inputPrefix) { global $TYPO3_CONF_VARS; if ($this->compatVersionIsCurrent()) { - $content = 'You updated from an older version of TYPO3:
- + '; $versions = array( '3.8' => '<= 3.8', '4.1' => '<= 4.1', '4.2' => '<= 4.2', ); foreach ($versions as $singleVersion => $caption) { - $content .= ''; + $content .= ' + + '; } - $content .= ''; + $content .= ' + + + + + '; } else { - $content = 'TYPO3 output is currently compatible to version '.$TYPO3_CONF_VARS['SYS']['compat_version'].'. To use all the new features in the current TYPO3 version, make sure you follow the guidelines below to upgrade without problems.
-

Follow the steps below carefully and confirm every step!
You will see this list again after you performed the update.

'; + $content = ' +

+ TYPO3 output is currently compatible to version ' . $TYPO3_CONF_VARS['SYS']['compat_version'] . '. + To use all the new features in the current TYPO3 version, + make sure you follow the guidelines below to upgrade without + problems. +

+

+ + Follow the steps below carefully and confirm every step! + +
+ You will see this list again after you performed the update. +

+ '; $content .= $this->showChangesNeeded($inputPrefix); - $content.= '

 


'; + $content.= ' +
+
    +
  1. + + +
  2. +
  3. + WARNING: this might break the output of your website. +
  4. +
+
+ '; } return $content; } @@ -203,15 +285,24 @@ $updateWizardBoxes.= '

'.(isset($details['title'])?$details['title']:$internalName).'

-

'.$description.'

'. + ' . $description . (strlen($description_acknowledge) ? '

'.$description_acknowledge.'

' : ''). - (strlen($inputPrefix) ? '

 

' : '').' + (strlen($inputPrefix) ? ' +
+
    +
  1. + + +
  2. +
+
+ ' : '').'
'; } } } if (strlen($updateWizardBoxes)) { - return '
'.$updateWizardBoxes.'
'; + return $updateWizardBoxes; } return ''; } Index: typo3/sysext/install/updates/class.tx_coreupdates_installnewsysexts.php =================================================================== --- typo3/sysext/install/updates/class.tx_coreupdates_installnewsysexts.php (revision 7289) +++ typo3/sysext/install/updates/class.tx_coreupdates_installnewsysexts.php (working copy) @@ -55,21 +55,40 @@ */ public function checkForUpdate(&$description) { $result = false; - $description = 'Install the following system extensions that are new in TYPO3 4.3:
'; + $description = ' +

+ Install the following system extensions that are new in TYPO3 + 4.3: +

+ '; + $description .= ' +
    + '; + foreach($this->newSystemExtensions as $_EXTKEY) { if (!t3lib_extMgm::isLoaded($_EXTKEY)) { $EM_CONF = FALSE; // extension may not been loaded at this point, so we can't use an API function from t3lib_extmgm require (PATH_site . 'typo3/sysext/' . $_EXTKEY . '/ext_emconf.php'); $description .= ' - ' . $EM_CONF[$_EXTKEY]['title'] . ' [' . $_EXTKEY . '] - ' . $EM_CONF[$_EXTKEY]['description'] . '
    '; +
  • + + ' . $EM_CONF[$_EXTKEY]['title'] . ' [' . $_EXTKEY . '] + +
    + ' . $EM_CONF[$_EXTKEY]['description'] . ' +
  • + '; $result = true; } } + $description .= ' +
+ '; + return $result; } @@ -80,17 +99,39 @@ * @return string HTML output */ public function getUserInput($inputPrefix) { - $content = 'Install the following system extensions that are new in TYPO3 4.3:
'; + $content = ' +

+ + Install the following system extensions that are new in + TYPO3 4.3: + +

+ '; + + $content .= ' +
+
    + '; + foreach($this->newSystemExtensions as $_EXTKEY) { if (!t3lib_extMgm::isLoaded($_EXTKEY)) { $EM_CONF = FALSE; // extension may not been loaded at this point, so we can't use an API function from t3lib_extmgm require (PATH_site . 'typo3/sysext/' . $_EXTKEY . '/ext_emconf.php'); $content .= ' -
    '; +
  1. + + +
  2. + '; } } + $content .= ' +
+
+ '; + return $content; } Index: typo3/sysext/install/updates/class.tx_coreupdates_installsysexts.php =================================================================== --- typo3/sysext/install/updates/class.tx_coreupdates_installsysexts.php (revision 7289) +++ typo3/sysext/install/updates/class.tx_coreupdates_installsysexts.php (working copy) @@ -55,12 +55,44 @@ */ public function checkForUpdate(&$description) { $result = false; - $description = 'Install the following system extensions as their functionality is moved out of the TYPO3 base installation and now optional:
- Help>About [about]
Shows info about TYPO3 and installed extensions.
- Help>TYPO3 Manual [cshmanual]
Shows TYPO3 inline user manual.
- Frontend Editing [feedit]
This module enables FE-editing, configuration is done by Typoscript.
- User>Open Documents [opendocs]
Handles the list of opened documents in TYPO3 backend.
- Simulate Static URLs [simulatestatic]
If you do not want to use RealURL or CoolURI but still want the Speaking URL feature. If you used "config.simulateStaticDocuments = 1" in this installation before, you should install this system extension. Be sure to read the manual of "simulatestatic".'; + $description = ' +

+ Install the following system extensions as their functionality + is moved out of the TYPO3 base installation and now optional: +

+
    +
  • + Help>About [about] +
    + Shows info about TYPO3 and installed extensions. +
  • +
  • + Help>TYPO3 Manual [cshmanual] +
    + Shows TYPO3 inline user manual. +
  • +
  • + Frontend Editing [feedit] +
    + This module enables FE-editing, configuration is done by + Typoscript. +
  • +
  • + User>Open Documents [opendocs] +
    + Handles the list of opened documents in TYPO3 backend. +
  • +
  • + Simulate Static URLs [simulatestatic] +
    + If you do not want to use RealURL or CoolURI but still want + the Speaking URL feature. If you used + "config.simulateStaticDocuments = 1" in this installation + before, you should install this system extension. Be sure to + read the manual of "simulatestatic". +
  • +
+ '; foreach($this->newSystemExtensions as $ext) { if (!t3lib_extMgm::isLoaded($ext)) { @@ -77,12 +109,37 @@ * @return string HTML output */ public function getUserInput($inputPrefix) { - $content = 'Install the following SystemExtensions:
-
-
-
-
-
'; + $content = ' +

+ + Install the following SystemExtensions + : +

+
+
    +
  1. + + +
  2. +
  3. + + +
  4. +
  5. + + +
  6. +
  7. + + +
  8. +
  9. + + +
  10. +
+
+ '; return $content; }