'; // 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 = '
- ';
-
+ // 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.
+
+ ', -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.
+
+ 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.
+
+ 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 = '';
+ // 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='
-
+
+ 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='
-
-
-
';
- $fileList.=' ('.$EDIT_path.')';
- if ($this->allowFileEditOutsite_typo3conf_dir) {
- $fileList.=' ';
- }
+ 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.= '';
+ 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 = '
- 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 = '';
- $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.
+
+ 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);
}
}
} 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);
}
}
// *****************
// 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+
+
+ 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', '
+
+ 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', '
+
+ 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.='
',-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:','
-
- ',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.
+
+ ', 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='
- ';
+ $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 '
+
+ ';
}
/**
* 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'].'
+
';
// 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
+
+ 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)
+
+ 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.
+
';
+ $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', '
+
';
+ // 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.='
';
+ // 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', '
+
+ ', 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.='
';
- }
+ // 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.
+
+ 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:
+ ' . $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 = '
+ When all updates are done you should check
+ your database for required updates.
+
+ Perform
+
+ COMPARE DATABASE
+
+ as often until no more changes are required.
+
+
+
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 = '
';
+ $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 = '