Project

General

Profile

Bug #25002 ยป 17544.diff

Administrator Admin, 2011-02-11 13:27

View differences:

typo3/install/index.php (working copy)
* @subpackage core
*/
/**
* Displays an error message and stops execution of the script
*
* @param array $markers The markers which should be displayed in the text
* @return void
*/
function installToolErrorMessage($markers) {
// Include t3lib_div and t3lib_parsehtml for templating
require_once($GLOBALS['PATH_site'] . '/t3lib/class.t3lib_div.php');
require_once($GLOBALS['PATH_site'] . '/t3lib/class.t3lib_parsehtml.php');
// Define the stylesheet
$stylesheet = '<link rel="stylesheet" type="text/css" href="' .
'../stylesheets/install/install.css" />';
$javascript = '<script type="text/javascript" src="' .
'../contrib/prototype/prototype.js"></script>' . LF;
$javascript .= '<script type="text/javascript" src="' .
'../sysext/install/Resources/Public/Javascript/install.js"></script>';
// Get the template file
$template = @file_get_contents($GLOBALS['PATH_site'] . '/typo3/templates/install.html');
// Define the markers content
$markers = array_merge($markers, array(
'styleSheet' => $stylesheet,
'javascript' => $javascript,
));
// Fill the markers
$content = t3lib_parsehtml::substituteMarkerArray(
$template,
$markers,
'###|###',
1,
1
);
// Output the warning message and exit
header('Content-Type: text/html; charset=utf-8');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
echo $content;
exit();
}
// **************************************************************************
// Insert some security here, if you don't trust the Install Tool Password:
// **************************************************************************
......
$enableInstallToolFile = $PATH_site . '/typo3conf/ENABLE_INSTALL_TOOL';
// If typo3conf/FIRST_INSTALL is present and can be deleted, automatically create typo3conf/ENABLE_INSTALL_TOOL
if (is_file($quickstartFile) && is_writeable($quickstartFile) && unlink($quickstartFile)) {
touch($enableInstallToolFile);
if (is_file($quickstartFile)) {
if ((is_writeable($quickstartFile)) && (is_writable($PATH_site . '/typo3conf/'))) {
unlink($quickstartFile);
touch($enableInstallToolFile);
} else {
// typo3conf is not writable. Display an error
$markers = array(
'title' => 'The Install Tool is locked',
'content' => '
<p>
To enable the Install Tool, the file ENABLE_INSTALL_TOOL must be created. Normally this is done automatically.
</p>
<p>
In order for this to work, the typo3conf/ folder has to be writable, which currently is not the case.
</p>
<ul>
<li>
Please make sure the typo3conf/ folder and its contents are writable by the webserver.
</li>
</ul>
<p>
For security reasons, it is highly recommended that you either rename or delete the file after the operation is finished.
</p>
<p>
As an additional security measure, if the file is older than one hour, TYPO3 will automatically delete it.
</p>
'
);
installToolErrorMessage($markers);
}
}
// Only allow Install Tool access if the file "typo3conf/ENABLE_INSTALL_TOOL" is found
......
// Change 1==2 to 1==1 if you want to lock the Install Tool regardless of the file ENABLE_INSTALL_TOOL
if (1==2 || !is_file($enableInstallToolFile)) {
// Include t3lib_div and t3lib_parsehtml for templating
require_once($PATH_site . '/t3lib/class.t3lib_div.php');
require_once($PATH_site . '/t3lib/class.t3lib_parsehtml.php');
// Define the stylesheet
$stylesheet = '<link rel="stylesheet" type="text/css" href="' .
'../stylesheets/install/install.css" />';
$javascript = '<script type="text/javascript" src="' .
'../contrib/prototype/prototype.js"></script>' . LF;
$javascript .= '<script type="text/javascript" src="' .
'../sysext/install/Resources/Public/Javascript/install.js"></script>';
// Get the template file
$template = @file_get_contents($PATH_site . '/typo3/templates/install.html');
// Define the markers content
$markers = array(
'styleSheet' => $stylesheet,
'javascript' => $javascript,
'title' => 'The Install Tool is locked',
'content' => '
<p>
......
</p>
'
);
// Fill the markers
$content = t3lib_parsehtml::substituteMarkerArray(
$template,
$markers,
'###|###',
1,
1
);
// Output the warning message and exit
header('Content-Type: text/html; charset=utf-8');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
echo $content;
exit();
installToolErrorMessage($markers);
}
    (1-1/1)