Project

General

Profile

Feature #22423 » 20100411_RFC_14064.diff

Administrator Admin, 2010-04-11 16:45

View differences:

typo3/sysext/install/mod/class.tx_install.php (working copy)
* 4823: function stepHeader()
* 4865: function note123()
* 4879: function endNotes()
* 4898: function convertByteSize($bytes)
* 4912: function securityRisk()
* 4930: function alterPasswordForm()
* 4946: function messageBasicFinished()
......
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_installnewsysexts.php');
require_once(t3lib_extMgm::extPath('install') . 'mod/class.tx_install_session.php');
require_once(t3lib_extMgm::extPath('install') . 'updates/class.tx_coreupdates_statictemplates.php');
require_once(PATH_tslib . 'class.tslib_content.php');
/**
* Install Tool module
......
* @subpackage tx_install
*/
class tx_install extends t3lib_install {
var $contentObject;
var $templateFilePath = 'typo3/sysext/install/Resources/Private/Templates/';
var $template;
var $javascript;
var $stylesheets;
var $markers = array();
var $messages = array();
var $errorMessages = array();
var $mailMessage = '';
var $getGD_start_string='<h2 align="center"><a name="module_gd">gd</a></h2>'; // Used to identify the GD section in the output from phpinfo()
var $getGD_end_string = '</table>'; // Used to identify the end of the GD section (found with getGD_start_string) in the output from phpinfo()
var $getTTF_string = 'with TTF library'; // Used to identify whether TTF-lib is included with GD
var $getTTF_string_alt = 'with freetype'; // Used to identify whether TTF-lib is included with GD
var $action = ''; // The url that calls this script
var $scriptSelf = 'index.php'; // The url that calls this script
var $fontTag2='<div class="bodytext">';
var $fontTag1='<div class="smalltext">';
var $updateIdentity = 'TYPO3 Install Tool';
var $headerStyle ='';
var $contentBeforeTable='';
......
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;
......
/**
* 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.<br />You must enable it by setting a password in typo3conf/localconf.php. If you insert the line below, the password will be 'joh316':<br /><br />\$TYPO3_CONF_VARS['BE']['installToolPassword'] = 'bacb98acf97e0b6112b1d1b650b84971';");
if ($this->sendNoCacheHeaders) {
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');
......
}
}
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'],
......
';
}
if ($this->session->isAuthorized() || $this->checkPassword()) {
if ($this->session->isAuthorized() || $this->checkPassword()) {
$this->passwordOK=1;
$this->session->refreshSession();
......
@touch($enableInstallToolFile);
}
if($this->redirect_url) {
if($this->redirect_url) {
t3lib_utility_Http::redirect($this->redirect_url);
}
} else {
......
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,
......
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)."'
......
}
/**
* [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 = '<form action="index.php" method="post" name="passwordForm">
<input type="password" name="password"><br />
<input type="hidden" name="redirect_url" value="'.htmlspecialchars($redirect_url).'">
<input type="submit" value="Log in"><br />
<br />
'.$this->fw('The Install Tool Password is <i>not</i> the admin password of TYPO3.<br />
If you don\'t know the current password, you can set a new one by setting the value of $TYPO3_CONF_VARS[\'BE\'][\'installToolPassword\'] in typo3conf/localconf.php to the md5() hash value of the password you desire.'.
($p ? '<br /><br />The password you just tried has this md5-value: <br /><br />'.md5($p) : '')
).'
</form>
<script type="text/javascript">
<!--
document.passwordForm.password.focus();
//-->
</script>';
// Add prototype to javascript array for output
$this->javascript[] = '<script type="text/javascript" src="' .
t3lib_div::getIndpEnv('TYPO3_SITE_URL') .
TYPO3_mainDir .
'contrib/prototype/prototype.js"></script>
';
// 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' => '
<p class="typo3-message message-information">
The Install Tool Password is <em>not</em> the admin password
of TYPO3.
<br />
If you don\'t know the current password, you can set a new
one by setting the value of
$TYPO3_CONF_VARS[\'BE\'][\'installToolPassword\'] in
typo3conf/localconf.php to the md5() hash value of the
password you desire.
</p>
'
);
// 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();
......
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',
'
<dl id="systemInformation">
<dt>OS detected:</dt>
<dd>' . (TYPO3_OS == 'WIN' ? 'WIN' : 'UNIX') .'</dd>
<dt>UNIX/CGI detected:</dt>
<dd>' . (PHP_SAPI == 'cgi' ? 'YES' : 'NO') . '</dd>
<dt>PATH_thisScript:</dt>
<dd>' . PATH_thisScript . '</dd>
</dl>
'
);
$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);
<p>
You need to specify database username,
password and host as one of the first things.
<br />
Next you\'ll have to select a database to
use with TYPO3.
</p>
<p>
Use the form below.
</p>
', 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);
<p>
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!
<br />
You should also check all warnings that may
appear.
</p>
', 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.
<strong><span style="color:#f00;">Step 2:</span></strong> <a href="'.$this->scriptSelf.'?TYPO3_INSTALL[type]=database'.($this->mode?'&mode='.rawurlencode($this->mode):'').'">Click here to install the database.</a>
',-1,1);
<p>
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.
</p>
<p>
<strong>
<span style="color:#f00;">Step 2: </span>
</strong>
<a href="' . $this->scriptSelf .
'?TYPO3_INSTALL[type]=database' .
($this->mode ? '&mode=' . rawurlencode($this->mode) : '') .
'">Click here to install the database.</a>
</p>
', -1, 1);
}
}
$this->message($ext, 'Very Important: Changing Image Processing settings', "
When you change the settings for Image Processing you <i>must</i> take into account that <u>old images</u> may still be in typo3temp/ folder and prevent new files from being generated! This is especially important to know, if you're trying to set up image processing for the very first time.
The problem is solved by <a href=\"".htmlspecialchars($this->setScriptName('typo3temp'))."\">clearing the typo3temp/ folder</a>. Also make sure to clear the cache_pages table.
",1,1);
$this->message($ext, 'Very Important: Changing Encryption Key setting', "
When you change the setting for the Encryption Key you <i>must</i> take into account that a change to this value might invalidate temporary information, URLs etc.
The problem is solved by <a href=\"".htmlspecialchars($this->setScriptName('typo3temp'))."\">clearing the typo3temp/ folder</a>. Also make sure to clear the cache_pages table.
",1,1);
$this->message($ext, 'Update localconf.php', "
This form updates the localconf.php file with the suggested values you see below. The values are based on the analysis above.
You can change the values in case you have alternatives to the suggested defaults.
By this final step you will configure TYPO3 for immediate use provided that you have no fatal errors left above."
.$this->setupGeneral('get_form'),0,1);
$this->message($ext, 'Very Important: Changing Image Processing settings', '
<p>
When you change the settings for Image Processing
you <em>must</em> take into account
that <em>old images</em> may still be in typo3temp/
folder and prevent new files from being generated!
<br />
This is especially important to know, if you\'re
trying to set up image processing for the very first
time.
<br />
The problem is solved by <a href="' .
htmlspecialchars($this->setScriptName('typo3temp')) .
'">clearing the typo3temp/ folder</a>.
Also make sure to clear the cache_pages table.
</p>
', 1, 1);
$this->message($ext, 'Very Important: Changing Encryption Key setting', '
<p>
When you change the setting for the Encryption Key
you <em>must</em> take into account that a change to
this value might invalidate temporary information,
URLs etc.
<br />
The problem is solved by <a href="' .
htmlspecialchars($this->setScriptName('typo3temp')) .
'">clearing the typo3temp/ folder</a>.
Also make sure to clear the cache_pages table.
</p>
', 1, 1);
$this->message($ext, 'Update localconf.php', '
<p>
This form updates the localconf.php file with the
suggested values you see below. The values are based
on the analysis above.
<br />
You can change the values in case you have
alternatives to the suggested defaults.
<br />
By this final step you will configure TYPO3 for
immediate use provided that you have no fatal errors
left above.
</p>' . $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 = '<form action="'.$this->action.'" method="post">'.$content.'<input type="submit" value="Write to localconf.php"><br /><br />
'.$this->fw('<strong>NOTICE: </strong>By clicking this button, localconf.php is updated with new values for the parameters listed above!<br />').'
</form>';
// 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':
......
$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', '
<p>
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.
<br />
There are three primary steps for you to take:
</p>
<p>
<strong>1: Basic Configuration</strong>
<br />
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.
<br />
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.
<br />
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.
</p>
<p>
<strong>2: Database Analyser</strong>
<br />
In this step you can either install a new database
or update the database from any previous TYPO3
version.
<br />
You can also get an overview of extra/missing
fields/tables in the database compared to a raw
sql-file.
<br />
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.
</p>
<p>
<strong>3: Update Wizard</strong>
<br />
Here you will find update methods taking care of
changes to the TYPO3 core which are not backwards
compatible.
<br />
It is recommended to run this wizard after every
update to make sure everything will still work
flawlessly.
</p>
<p>
<strong>4: Image Processing</strong>
<br />
This step is a visual guide to verify your
configuration of the image processing software.
<br />
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.
</p>
<p>
<strong>5: All Configuration</strong>
<br />
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.
</p>
<p>
<strong>6: typo3temp/</strong>
<br />
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.
</p>
');
<strong>1: Basic Configuration</strong>
In this step your PHP-configuration is checked. If there are any settings that will prevent TYPO3 from running correctly you'll get warnings and errors with a description of the problem.
You'll have to enter a database username, password and hostname. Then you can choose to create a new database or select an existing one.
Finally the image processing settings are entered and verified and you can choose to let the script update the configuration file, typo3conf/localconf.php with the suggested settings.
$this->message('About', 'Why is this script stand-alone?', '
<p>
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.
<br />
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 <em>only</em> when calling the script
\'typo3/install/index.php\' - this script!
</p>
');
<strong>2: Database Analyser</strong>
In this step you can either install a new database or update the database from any previous TYPO3 version.
You can also get an overview of extra/missing fields/tables in the database compared to a raw sql-file.
The database is also verified agains your 'tables.php' configuration (\$TCA) and you can even see suggestions to entries in \$TCA or new fields in the database.
<strong>3: Update Wizard</strong>
Here you will find update methods taking care of changes to the TYPO3 core which are not backwards compatible.
It is recommended to run this wizard after every update to make sure everything will still work flawlessly.
<strong>4: Image Processing</strong>
This step is a visual guide to verify your configuration of the image processing software.
You'll be presented to a list of images that should all match in pairs. If some irregularity appears, you'll get a warning. Thus you're able to track an error before you'll discover it on your website.
<strong>5: All Configuration</strong>
This gives you access to any of the configuration options in the TYPO3_CONF_VARS array. Every option is also presented with a comment explaining what it does.
<strong>6: typo3temp/</strong>
Here you can manage the files in typo3temp/ folder in a simple manner. typo3temp/ contains temporary files, which may still be used by the website, but some may not. By searching for files with old access-dates, you can possibly manage to delete unused files rather than files still used. However if you delete a temporary file still in use, it's just regenerated as long as you make sure to clear the cache tables afterwards.
");
$this->message('About', 'Why is this script stand-alone?', "
You would think that this script should rather be a module in the backend and access-controlled to only admin-users from the database. But that's not how it works.
The reason is, that this script must not be depending on the success of the configuration of TYPO3 and whether or not there is a working database behind. Therefore the script is invoked from the backend init.php file, which allows access if the constant 'TYPO3_enterInstallScript' has been defined and is not false. That is and should be the case <i>only</i> when calling the script 'typo3/install/index.php' - this script!
");
$headCode='Header legend';
$this->message($headCode, 'Notice!', '
Indicates that something is important to be aware of.
This does <em>not</em> indicate an error.
',1);
<p>
Indicates that something is important to be aware
of.
<br />
This does <em>not</em> indicate an error.
</p>
', 1);
$this->message($headCode, 'Just information', '
This is a simple message with some information about something.
<p>
This is a simple message with some information about
something.
</p>
');
$this->message($headCode, 'Check was successful', '
Indicates that something was checked and returned an expected result.
',-1);
<p>
Indicates that something was checked and returned an
expected result.
</p>
', -1);
$this->message($headCode, 'Warning!', '
Indicates that something may very well cause trouble and you should definitely look into it before proceeding.
This indicates a <em>potential</em> error.
',2);
<p>
Indicates that something may very well cause trouble
and you should definitely look into it before
proceeding.
<br />
This indicates a <em>potential</em> error.
</p>
', 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);
<p>
Indicates that something is definitely wrong and
that TYPO3 will most likely not perform as expected
if this problem is not solved.
<br />
This indicates an actual error.
</p>
', 3);
$this->output($this->outputWrapper($this->printAll()));
break;
......
/**
* 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='<br />
'.$this->fontTag2.'<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" class="absmiddle">
There is no connection to the database!<br />
(Username: <i>' . TYPO3_db_username . '</i>, Host: <i>' . TYPO3_db_host . '</i>, Using Password: YES) . <br />
<br />
<strong>Go to Step 1</strong> and enter a proper username/password!</span>
<br />
<br />
$error_missingConnect = '
<p class="typo3-message message-error">
<strong>
There is no connection to the database!
</strong>
<br />
(Username: <em>' . TYPO3_db_username . '</em>,
Host: <em>' . TYPO3_db_host . '</em>,
Using Password: YES)
<br />
Go to Step 1 and enter a proper username/password!
</p>
';
$error_missingDB='<br />
'.$this->fontTag2.'<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" class="absmiddle">
There is no access to the database (<i>'.TYPO3_db.'</i>)!<br />
<br />
<strong>Go to Step 2</strong> and select an accessible database!</span>
<br />
<br />
$error_missingDB = '
<p class="typo3-message message-error">
<strong>
There is no access to the database (<em>' . TYPO3_db . '</em>)!
</strong>
<br />
Go to Step 2 and select an accessible database!
</p>
';
// 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='
<table border="0" cellpadding="1" cellspacing="0">
<tr>
<td valign="top" nowrap="nowrap" colspan="2" align="center">'.$this->fontTag2.'<strong><img src="'.$this->backPath.'gfx/icon_note.gif" hspace="5" width="18" height="16" class="absmiddle">Database summary:</strong></span></td>
</tr>
<tr>
<td valign="top" nowrap="nowrap">'.$this->fontTag1.'Username:</span></td>
<td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db_username.'</span></strong></td>
</tr>
<tr>
<td valign="top" nowrap="nowrap">'.$this->fontTag1.'Host:</span></td>
<td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db_host.'</span></strong></td>
</tr>
<tr>
<td valign="top" nowrap="nowrap">'.$this->fontTag1.'Database:</span></td>
<td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db.'</span></strong></td>
</tr>
<tr>
<td valign="top" nowrap="nowrap">'.$this->fontTag1.'# of tables:</span></td>
<td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.(count($whichTables)?'<span style="color:#f00;">'.count($whichTables).'</span>':count($whichTables)).'</span></strong></td>
</tr>
</table>
$whichTables = ($this->step != 1 && $this->step != 2 ? $this->getListOfTables() : array());
$error_emptyDB = '
<p class="typo3-message message-error">
<strong>
The database is still empty. There are no tables!
</strong>
<br />
Go to Step 3 and import a database!
</p>
';
$error_emptyDB='<br />
'.$this->fontTag2.'<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" class="absmiddle">
The database is still empty. There are no tables!<br />
<br />
<strong>Go to Step 3</strong> and import a database!</span>
<br />
<br />
';
switch(strtolower($this->step)) {
case 1:
$msg='
<br />
<br />
<table border="0">
<form action="'.$this->action.'" method="post">
<tr>
<td valign="top" nowrap="nowrap"><strong>
'.$this->fontTag2.'Username:</span></strong>
</td>
<td> &nbsp;
</td>
<td valign="top">
'.$this->fontTag2.'
<input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_username]" value="'.TYPO3_db_username.'"></span><br />
</td>
</tr>
<tr>
<td valign="top" nowrap="nowrap"><strong>
'.$this->fontTag2.'Password:</span></strong>
</td>
<td> &nbsp;
</td>
<td valign="top">
'.$this->fontTag2.'
<input type="password" name="TYPO3_INSTALL[localconf.php][typo_db_password]" value="'.TYPO3_db_password.'"></span><br />
</td>
</tr>
<tr>
<td valign="top" nowrap="nowrap"><strong>
'.$this->fontTag2.'Host:</span></strong>
</td>
<td> &nbsp;
</td>
<td valign="top">
'.$this->fontTag2.'
<input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_host]" value="'.(TYPO3_db_host?TYPO3_db_host:'localhost').'"></span><br />
</td>
</tr>
<tr>
<td valign="top" nowrap="nowrap"><strong>
'.$this->fontTag1.'</span></strong>
</td>
<td> &nbsp;
</td>
<td valign="top">
'.$this->fontTag1.'<br />
<input type="hidden" name="step" value="2">
<input type="hidden" name="TYPO3_INSTALL[localconf.php][encryptionKey]" value="' . $this->createEncryptionKey() . '">
<input type="hidden" name="TYPO3_INSTALL[localconf.php][compat_version]" value="'.TYPO3_branch.'">
<input type="submit" value="Continue"><br /><br /><strong>NOTICE: </strong>By clicking this button, typo3conf/localconf.php is updated with new values for the parameters listed above!</span><br />
</td>
</tr>
</form>
</table>
<br />
<br />';
break;
case 2:
if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
$dbArr = $this->getDatabaseList();
$options = '<option value="">[ SELECT DATABASE ]</option>';
$dbIncluded = 0;
foreach ($dbArr as $dbname) {
$options.='<option value="'.htmlspecialchars($dbname).'"'.($dbname==TYPO3_db?' selected="selected"':'').'>'.htmlspecialchars($dbname).'</option>';
if ($dbname==TYPO3_db) $dbIncluded=1;
}
if (!$dbIncluded && TYPO3_db) {
$options.='<option value="'.htmlspecialchars(TYPO3_db).'" selected="selected">'.htmlspecialchars(TYPO3_db).' (NO ACCESS!)</option>';
}
$select='<select name="TYPO3_INSTALL[localconf.php][typo_db]">'.$options.'</select>';
$msg='
<br />
<br />
<table border="0">
<form action="'.$this->action.'" method="post">
<tr>
<td valign="top" nowrap="nowrap"><strong>
'.$this->fontTag2.'
You have two options:<br />
<br /><br />
// Hook to override and add steps to the 1-2-3 installer
if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['stepOutput'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['stepOutput'] as $classData) {
$hookObject = t3lib_div::getUserObj($classData);
$hookObject->execute($markers, $this->step, $this);
}
}
// Use the default steps when there is no override
if (!$markers['header'] && !$markers['step']) {
switch(strtolower($this->step)) {
case 1:
// Get the subpart for the first step
$step1SubPart = $this->contentObject->getSubpart(
$templateFile, '###STEP1###'
);
// Add header marker for main template
$markers['header'] = 'Welcome to the TYPO3 installation process';
// Define the markers content for the subpart
$step1SubPartMarkers = array(
'llIntroduction' => '
<p>
TYPO3 is an enterprise content management system
that is very powerfull and yet easy to install.
</p>
<p>
Choose your database, import some data and
you\'re done!
</p>
',
'step' => $this->step + 1,
'action' => htmlspecialchars($this->action),
'continue' => 'Continue'
);
// Add step marker for main template
$markers['step'] = $this->contentObject->substituteMarkerArray(
$step1SubPart,
$step1SubPartMarkers,
'###|###',
1,
1
);
break;
case 2:
// Get the subpart for the second step
$step2SubPart = $this->contentObject->getSubpart(
$templateFile, '###STEP2###'
);
// Add header marker for main template
$markers['header'] = 'Connect to your database host';
// Define the markers content for the subpart
$step2SubPartMarkers = array(
'step' => $this->step + 1,
'action' => htmlspecialchars($this->action),
'encryptionKey' => $this->createEncryptionKey(),
'branch' => TYPO3_branch,
'labelUsername' => 'Username',
'username' => TYPO3_db_username,
'labelPassword' => 'Password',
'password' => TYPO3_db_password,
'labelHost' => 'Host',
'host' => TYPO3_db_host ? TYPO3_db_host : 'localhost',
'continue' => 'Continue'
);
// Add step marker for main template
$markers['step'] = $this->contentObject->substituteMarkerArray(
$step2SubPart,
$step2SubPartMarkers,
'###|###',
1,
1
);
break;
case 3:
// Add header marker for main template
$markers['header'] = 'Select database';
// There should be a database host connection at this point
if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(
TYPO3_db_host, TYPO3_db_username, TYPO3_db_password
)) {
// Get the subpart for the third step
$step3SubPart = $this->contentObject->getSubpart(
$templateFile, '###STEP3###'
);
// Get the subpart for the database options
$step3DatabaseOptionsSubPart = $this->contentObject->getSubpart(
$step3SubPart, '###DATABASEOPTIONS###'
);
1: Select an existing <u>EMPTY</u> database:</span></strong>
</td>
</tr>
<tr>
<td valign="top">
'.$this->fontTag1.'Any existing tables which are used by TYPO3 will be overwritten in Step 3. So make sure this database is empty:<br />'.$select.'</span><br />
</td>
</tr>
<tr>
<td valign="top" nowrap="nowrap"><br />
<br />
<strong>
'.$this->fontTag2.'2: Create new database (recommended):</span></strong>
</td>
</tr>
<tr>
<td valign="top">
'.$this->fontTag1.'Enter the desired name of the database here:<br /><input type="text" name="TYPO3_INSTALL[localconf.php][NEW_DATABASE_NAME]" value=""></span><br />
</td>
</tr>
<tr>
<td valign="top"> <br />
'.$this->fontTag1.'<br />
<input type="hidden" name="step" value="3">
<input type="submit" value="Continue"><br /><br /><strong>NOTICE: </strong>By clicking this button, typo3conf/localconf.php is updated with new values for the parameters listed above!</span><br />
</td>
</tr>
</form>
</table>
<br />
<br />
';
} else {
$msg=$error_missingConnect;
}
break;
case 3:
if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
$sFiles = t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1);
// Check if default database scheme "database.sql" already exists, otherwise create it
if (!strstr(implode(',',$sFiles).',', '/database.sql,')) {
array_unshift($sFiles,'Create default database tables');
$dbArr = $this->getDatabaseList();
$dbIncluded = 0;
foreach ($dbArr as $dbname) {
// Define the markers content for database options
$step3DatabaseOptionMarkers = array(
'databaseValue' => htmlspecialchars($dbname),
'databaseSelected' => $dbname == TYPO3_db ? 'selected="selected"' : '',
'databaseName' => htmlspecialchars($dbname)
);
// Add the option HTML to an array
$step3DatabaseOptions[] = $this->contentObject->substituteMarkerArray(
$step3DatabaseOptionsSubPart,
$step3DatabaseOptionMarkers,
'###|###',
1,
1
);
if ($dbname==TYPO3_db) $dbIncluded=1;
}
$opt='';
foreach ($sFiles as $f) {
if ($f=='Create default database tables') $key='CURRENT_TABLES+STATIC';
else $key=htmlspecialchars($f);
$opt.='<option value="import|'.$key.'">'.htmlspecialchars(basename($f)).'</option>';
if (!$dbIncluded && TYPO3_db) {
// // Define the markers content when no access
$step3DatabaseOptionMarkers = array(
'databaseValue' => htmlspecialchars(TYPO3_db),
'databaseSelected' => 'selected="selected"',
'databaseName' => htmlspecialchars(TYPO3_db) . ' (NO ACCESS!)'
);
// Add the option HTML to an array
$step3DatabaseOptions[] = $this->contentObject->substituteMarkerArray(
$step3DatabaseOptionsSubPart,
$step3DatabaseOptionMarkers,
'###|###',
1,
1
);
}
// Substitute the subpart for the database options
$content = $this->contentObject->substituteSubpart(
$step3SubPart,
'###DATABASEOPTIONS###',
implode(chr(10), $step3DatabaseOptions)
);
// Define the markers content
$step3SubPartMarkers = array(
'step' => $this->step + 1,
'llOptions' => 'You have two options in this step.',
'action' => htmlspecialchars($this->action),
'llOption1' => '1: Create new database (recommended):',
'llRemark1' => 'Enter your desired name for the database.',
'llOption2' => '2: Select an EMPTY existing database:',
'llRemark2' => 'All tables used by TYPO3 will be overwritten in step 3.',
'continue' => 'Continue'
);
// Add step marker for main template
$markers['step'] = $this->contentObject->substituteMarkerArray(
$content,
$step3SubPartMarkers,
'###|###',
1,
1
);
} else {
// Add step marker for main template when no connection
$markers['step'] = $error_missingConnect;
}
break;
case 4:
// Add header marker for main template
$markers['header'] = 'Import the database sql-file';
// There should be a database host connection at this point
if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(
TYPO3_db_host, TYPO3_db_username, TYPO3_db_password
)) {
// The selected database should be accessible
if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
// Get the subpart for the fourth step
$step4SubPart = $this->contentObject->getSubpart(
$templateFile, '###STEP4###'
);
// Get the subpart for the database type options
$step4DatabaseTypeOptionsSubPart = $this->contentObject->getSubpart(
$step4SubPart, '###DATABASETYPEOPTIONS###'
);
$sFiles = t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1);
$content='
'.$this->fontTag2.'Please select a database dump:</span><br />
<input type="hidden" name="TYPO3_INSTALL[database_import_all]" value=1>
<input type="hidden" name="step" value="">
<input type="hidden" name="goto_step" value="go">
<select name="TYPO3_INSTALL[database_type]">'.$opt.'</select><br />';
// Check if default database scheme "database.sql" already exists, otherwise create it
if (!strstr(implode(',',$sFiles).',', '/database.sql,')) {
array_unshift($sFiles,'Create default database tables');
}
$content = $this->getUpdateDbFormWrap('import', $content, 'Import database');
$msg='
<br />
'.$dbInfo.'<br />
<br />
'.$content.'
';
$opt='';
foreach ($sFiles as $f) {
if ($f=='Create default database tables') $key='CURRENT_TABLES+STATIC';
else $key=htmlspecialchars($f);
// Define the markers content for database type subpart
$step4DatabaseTypeOptionMarkers = array(
'databaseTypeValue' => 'import|' . $key,
'databaseName' => htmlspecialchars(basename($f))
);
// Add the option HTML to an array
$step4DatabaseTypeOptions[] = $this->contentObject->substituteMarkerArray(
$step4DatabaseTypeOptionsSubPart,
$step4DatabaseTypeOptionMarkers,
'###|###',
1,
1
);
}
// Substitute the subpart for the database type options
$content = $this->contentObject->substituteSubpart(
$step4SubPart,
'###DATABASETYPEOPTIONS###',
implode(chr(10), $step4DatabaseTypeOptions)
);
// Define the markers content
$step4SubPartMarkers = array(
'llSummary' => 'Database summary:',
'llUsername' => 'Username:',
'username' => TYPO3_db_username,
'llHost' => 'Host:',
'host' => TYPO3_db_host,
'llDatabase' => 'Database:',
'database' => TYPO3_db,
'llNumberTables' => 'Number of tables:',
'numberTables' => count($whichTables),
'action' => htmlspecialchars($this->action),
'llDatabaseType' => 'Please select a database dump:',
'label' => 'Import database'
);
// Add step marker for main template
$markers['step'] = $this->contentObject->substituteMarkerArray(
$content,
$step4SubPartMarkers,
'###|###',
1,
1
);
} else {
// Add step marker for main template when no database
$markers['step'] = $error_missingDB;
}
} else {
$msg=$error_missingDB;
// Add step marker for main template when no connection
$markers['step'] = $error_missingConnect;
}
} else {
$msg=$error_missingConnect;
}
break;
case 'go':
if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
if (count($whichTables)) {
$msg='
<br />
'.$this->fontTag2.'
'.nl2br($this->messageBasicFinished()).'
<br />
<hr />
<div align="center"><strong><img src="'.$this->backPath.'gfx/icon_warning.gif" hspace="5" width="18" height="16" class="absmiddle">IMPORTANT</strong></div><br />
<span class="smalltext">'.nl2br($this->securityRisk()).'
<br />
<strong>Enter <a href="'.$this->scriptSelf.'">"Normal" mode for the Install Tool</a> to change this!</strong><br />
</span>
</span><br />
';
break;
case 'go':
// Add header marker for main template
$markers['header'] = 'You\'re done!';
// There should be a database host connection at this point
if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(
TYPO3_db_host, TYPO3_db_username, TYPO3_db_password
)) {
// The selected database should be accessible
if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
// The database should contain tables
if (count($whichTables)) {
// Get the subpart for the go step
$stepGoSubPart = $this->contentObject->getSubpart(
$templateFile, '###STEPGO###'
);
// Define the markers content
$stepGoSubPartMarkers = array(
'messageBasicFinished' => $this->messageBasicFinished(),
'llImportant' => 'Important',
'securityRisk' => $this->securityRisk(),
'llSwitchMode' => 'Enter
<a href="' . $this->scriptSelf . '">
"Normal"
</a>
mode for the Install Tool to change this!
'
);
// Add step marker for main template
$markers['step'] = $this->contentObject->substituteMarkerArray(
$stepGoSubPart,
$stepGoSubPartMarkers,
'###|###',
1,
1
);
} else {
// Add step marker for main template when empty database
$markers['step'] = $error_emptyDB;
}
} else {
$msg=$error_emptyDB;
// Add step marker for main template when no database
$markers['step'] = $error_missingDB;
}
} else {
$msg=$error_missingDB;
// Add step marker for main template when no connection
$markers['step'] = $error_missingConnect;
}
} else {
$msg=$error_missingConnect;
}
break;
break;
}
}
return $msg;
// Fill the markers in the template
$content = $this->contentObject->substituteMarkerArray(
$template,
$markers,
'###|###',
1,
1
);
return $content;
}
/**
* Calling the functions that checks the system
*
* @return [type] ...
* @return void
*/
function checkTheConfig() {
function checkTheConfig() {
// Order important:
$this->checkDirs();
$this->checkConfiguration();
$this->checkExtensions();
if (TYPO3_OS=='WIN') {
if (TYPO3_OS=='WIN') {
$paths=array($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'], $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'], 'c:\\php\\imagemagick\\', 'c:\\php\\GraphicsMagick\\', 'c:\\apache\\ImageMagick\\', 'c:\\apache\\GraphicsMagick\\');
} else {
$paths=array($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'], $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'], '/usr/local/bin/','/usr/bin/','/usr/X11R6/bin/');
}
asort($paths);
if (ini_get('safe_mode')) {
if (ini_get('safe_mode')) {
$paths=array(ini_get('safe_mode_exec_dir'),'/usr/local/php/bin/');
}
if ($this->INSTALL['checkIM']['lzw']) {
if ($this->INSTALL['checkIM']['lzw']) {
$this->checkIMlzw=1;
}
if ($this->INSTALL['checkIM']['path']) {
if ($this->INSTALL['checkIM']['path']) {
$paths[]=trim($this->INSTALL['checkIM']['path']);
}
if ($this->checkIM) $this->checkImageMagick($paths);
......
/**
* Editing files in typo3conf directory (or elsewhere if enabled)
*
* @return [type] ...
* @return void
*/
function typo3conf_edit() {
$EDIT_path = PATH_typo3conf; // default:
if ($this->allowFileEditOutsite_typo3conf_dir && $this->INSTALL['FILE']['EDIT_path']) {
if (t3lib_div::validPathStr($this->INSTALL['FILE']['EDIT_path']) && substr($this->INSTALL['FILE']['EDIT_path'],-1)=='/') {
function typo3conf_edit() {
// default:
$EDIT_path = PATH_typo3conf;
if ($this->allowFileEditOutsite_typo3conf_dir && $this->INSTALL['FILE']['EDIT_path']) {
if (t3lib_div::validPathStr($this->INSTALL['FILE']['EDIT_path']) && substr($this->INSTALL['FILE']['EDIT_path'],-1)=='/') {
$tmp_path = PATH_site.$this->INSTALL['FILE']['EDIT_path'];
if (is_dir($tmp_path)) {
if (is_dir($tmp_path)) {
$EDIT_path=$tmp_path;
} else {debug("'".$tmp_path."' was not dir");}
} else {
$this->errorMessages[] = '
\'' . $tmp_path . '\' was not directory
';
}
} else {
debug('BAD DIR_NAME (must be like t3lib/ or media/script/)');
$this->errorMessages[] = '
Bad directory name (must be like t3lib/ or media/script/)
';
}
}
$headCode = 'Edit files in '.basename($EDIT_path).'/';
$this->contentBeforeTable='';
$messages = '';
if ($this->INSTALL['SAVE_FILE']) {
if ($this->INSTALL['SAVE_FILE']) {
$save_to_file = $this->INSTALL['FILE']['name'];
if (@is_file($save_to_file)) {
if (@is_file($save_to_file)) {
$save_to_file_md5 = md5($save_to_file);
if (isset($this->INSTALL['FILE'][$save_to_file_md5]) && t3lib_div::isFirstPartOfStr($save_to_file,$EDIT_path.'') && substr($save_to_file,-1)!='~' && !strstr($save_to_file,'_bak')) {
if (isset($this->INSTALL['FILE'][$save_to_file_md5]) && t3lib_div::isFirstPartOfStr($save_to_file,$EDIT_path.'') && substr($save_to_file,-1)!='~' && !strstr($save_to_file,'_bak')) {
$this->INSTALL['typo3conf_files'] = $save_to_file;
$save_fileContent = $this->INSTALL['FILE'][$save_to_file_md5];
if ($this->INSTALL['FILE']['win_to_unix_br']) {
if ($this->INSTALL['FILE']['win_to_unix_br']) {
$save_fileContent = str_replace(chr(13).chr(10),chr(10),$save_fileContent);
}
$backupFile = $this->getBackupFilename($save_to_file);
if ($this->INSTALL['FILE']['backup']) {
if (@is_file($backupFile)) { unlink($backupFile); }
if ($this->INSTALL['FILE']['backup']) {
if (@is_file($backupFile)) { unlink($backupFile); }
rename($save_to_file,$backupFile);
$this->contentBeforeTable.='Backup written to <strong>'.$backupFile.'</strong><br />';
$messages .= '
Backup written to <strong>' . $backupFile . '</strong>
<br />
';
}
t3lib_div::writeFile($save_to_file,$save_fileContent);
$this->contentBeforeTable.='
File saved: <strong>'.$save_to_file.'</strong><br />
MD5-sum: '.$this->INSTALL['FILE']['prevMD5'].' (prev)<br />
MD5-sum: '.md5($save_fileContent).' (new)<br />
$messages .= '
File saved: <strong>' . $save_to_file . '</strong>
<br />
MD5-sum: ' . $this->INSTALL['FILE']['prevMD5'] . ' (prev)
<br />
MD5-sum: ' . md5($save_fileContent) . ' (new)
<br />
';
}
}
}
// Filelist:
// Get the template file
$templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'Typo3ConfEdit.html');
// Get the template part from the file
$template = $this->contentObject->getSubpart($templateFile, '###TEMPLATE###');
// Get the subpart for the files
$filesSubpart = $this->contentObject->getSubpart($template, '###FILES###');
$files = array();
$typo3conf_files = t3lib_div::getFilesInDir($EDIT_path,'',1,1);
reset($typo3conf_files);
$lines=array();
$fileFound = 0;
while(list($k,$file)=each($typo3conf_files)) {
foreach ($typo3conf_files as $k => $file) {
// Delete temp_CACHED files if option is set
if ( $this->INSTALL['delTempCached'] && preg_match('|/temp_CACHED_[a-z0-9_]+\.php|', $file)) {
if ( $this->INSTALL['delTempCached'] && preg_match('|/temp_CACHED_[a-z0-9_]+\.php|', $file)) {
unlink($file);
continue;
}
if ($this->INSTALL['typo3conf_files'] && !strcmp($this->INSTALL['typo3conf_files'],$file)) {
$wrap=array('<strong><span style="color:navy;">','</span></strong>');
if ($this->INSTALL['typo3conf_files'] && !strcmp($this->INSTALL['typo3conf_files'],$file)) {
$fileFound = 1;
} else {$wrap=array();}
$lines[]='<tr><td nowrap="nowrap"><a href="'.$this->action.'&TYPO3_INSTALL[typo3conf_files]='.rawurlencode($file).($this->allowFileEditOutsite_typo3conf_dir?'&TYPO3_INSTALL[FILE][EDIT_path]='.rawurlencode($this->INSTALL['FILE']['EDIT_path']):"").'">'.$this->fw($wrap[0].basename($file).$wrap[1].'&nbsp;&nbsp;&nbsp;').'</a></td><td>'.$this->fw(t3lib_div::formatSize(filesize($file))).'</td></tr>';
}
// Define the markers content for the files subpart
$filesMarkers = array(
'editUrl' => $this->action . '&amp;TYPO3_INSTALL[typo3conf_files]=' . rawurlencode($file) . ($this->allowFileEditOutsite_typo3conf_dir ? '&amp;TYPO3_INSTALL[FILE][EDIT_path]=' . rawurlencode($this->INSTALL['FILE']['EDIT_path']) : '') . '#confEditFileList',
'fileName' => basename($file),
'fileSize' => t3lib_div::formatSize(filesize($file)),
'class' => $this->INSTALL['typo3conf_files'] && !strcmp($this->INSTALL['typo3conf_files'], $file) ? 'class="act"' : ''
);
// Fill the markers in the subpart
$files[] = $this->contentObject->substituteMarkerArray(
$filesSubpart,
$filesMarkers,
'###|###',
1,
1
);
}
$fileList='<table border="0" cellpadding="0" cellspacing="0">'.implode('',$lines).'</table>';
$fileList.='<br />('.$EDIT_path.')';
if ($this->allowFileEditOutsite_typo3conf_dir) {
$fileList.='<br /><form action="'.$this->action.'" method="post">
'.PATH_site.'<input type="text" name="TYPO3_INSTALL[FILE][EDIT_path]" value="'.$this->INSTALL['FILE']['EDIT_path'].'"><input type="submit" name="" value="Set">
</form>';
}
if ($fileFound && @is_file($this->INSTALL['typo3conf_files'])) {
// create link for deleting temp_CACHED files
$fileList .= '<br /><br /><a href="'.$this->action.'&TYPO3_INSTALL[delTempCached]=1">Delete temp_CACHED* files</a>';
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.= '<div class="editFile"><form action="'.$this->action.'" method="post">'.(substr($this->INSTALL['typo3conf_files'],-1)!='~' && !strstr($this->INSTALL['typo3conf_files'],'_bak') ? '
<input type="submit" name="TYPO3_INSTALL[SAVE_FILE]" value="Save file">&nbsp;' : '').'
<input type="submit" name="_close" value="Close">
<br />File: '.$this->INSTALL['typo3conf_files'].'
<br />MD5-sum: '.md5($fileContent).'
<br />
// Get the subpart to edit the files
$fileEditTemplate = $this->contentObject->getSubpart($template, '###FILEEDIT###');
$allowFileEditOutsideTypo3ConfDirSubPart = '';
<input type="hidden" name="TYPO3_INSTALL[FILE][name]" value="'.$this->INSTALL['typo3conf_files'].'">
'.($this->allowFileEditOutsite_typo3conf_dir?'<input type="hidden" name="TYPO3_INSTALL[FILE][EDIT_path]" value="'.$this->INSTALL['FILE']['EDIT_path'].'">':'').'
<input type="hidden" name="TYPO3_INSTALL[FILE][prevMD5]" value="'.md5($fileContent).'">
<textarea rows="30" name="TYPO3_INSTALL[FILE]['.md5($this->INSTALL['typo3conf_files']).']" wrap="off"'.$this->formWidthText(48,'width:98%;height:80%','off').' class="fixed-font enable-tab">'.t3lib_div::formatForTextarea($fileContent).'</textarea><br />
<input type="checkbox" name="TYPO3_INSTALL[FILE][win_to_unix_br]" id="win_to_unix_br" value="1"'.(TYPO3_OS=='WIN'?'':' checked="checked"').'> <label for="win_to_unix_br">Convert Windows linebreaks (13-10) to Unix (10)</label><br />
<input type="checkbox" name="TYPO3_INSTALL[FILE][backup]" id="backup" value="1"'.(@is_file($backupFile) ? ' checked="checked"' : '').'> <label for="backup">Make backup copy (rename to '.basename($backupFile).')</label><br />
'.
'</form></div>';
if (substr($this->INSTALL['typo3conf_files'], -1) != '~' && !strstr($this->INSTALL['typo3conf_files'], '_bak')) {
// Get the subpart to show the save button
... This diff was truncated because it exceeds the maximum size that can be displayed.
(2-2/2)