Index: typo3/install/index.php =================================================================== --- typo3/install/index.php (revision 10516) +++ typo3/install/index.php (working copy) @@ -34,8 +34,48 @@ * @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 = ''; + $javascript = '' . LF; + $javascript .= ''; + // 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: // ************************************************************************** @@ -58,8 +98,24 @@ $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' => '"typo3conf" folder is not writable', + 'content' => ' +

+ The TYPO3 Install Tool requires the typo3conf/ folder to be writable. Please change the rights accordingly and reload this page. +

+ ' + ); + + installToolErrorMessage($markers); + } } // Only allow Install Tool access if the file "typo3conf/ENABLE_INSTALL_TOOL" is found @@ -75,24 +131,8 @@ // 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 = ''; - $javascript = '' . LF; - $javascript .= ''; - - // 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' => '

@@ -117,20 +157,8 @@

' ); - // 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); }