Fixed bug #14088: Change typo3/install/index.php install tool locked message to prope...
authorPatrick Broens <patrick@netcreators.com>
Tue, 13 Apr 2010 08:08:22 +0000 (08:08 +0000)
committerPatrick Broens <patrick@netcreators.com>
Tue, 13 Apr 2010 08:08:22 +0000 (08:08 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7330 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/css/install.css [new file with mode: 0644]
typo3/gfx/installbackground.jpg [new file with mode: 0644]
typo3/gfx/installlogo.gif [new file with mode: 0644]
typo3/install/index.php
typo3/templates/install.html [new file with mode: 0644]

index a0cae14..518153f 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-13  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Fixed bug #14088: Change typo3/install/index.php install tool locked message to proper HTML and CSS
+
 2010-04-13  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Follow-up to feature #14051: htmlArea RTE: Streamline the RTE loading process
diff --git a/typo3/css/install.css b/typo3/css/install.css
new file mode 100644 (file)
index 0000000..3fe7d23
--- /dev/null
@@ -0,0 +1,49 @@
+@CHARSET "UTF-8";
+
+/* Font size 62.8% = 1em = 10px */
+body {
+       font: 62.8% Verdana, Arial, Helvetica, sans-serif;
+       background-color: #f2f2f2;
+       padding-top: 11em;
+}
+
+body.standalone {
+       background: #4f4f4f url('../gfx/installbackground.jpg') repeat-x fixed;
+}
+
+h1 {
+       display: none;
+}
+
+.standalone h1 {
+       background: url('../gfx/installlogo.gif') no-repeat scroll 0 0 transparent;
+       text-indent:-999em;
+       display: block;
+       height: 34px;
+       margin: 0 0 1.85em;
+}
+
+h2 {
+       margin-top: 0;
+}
+
+#container {
+       margin: 0 auto;
+       width: 39em;
+       font-size: 110%;
+       line-height: 1.5em;
+}
+
+.typo3-message {
+       padding: 0.6em 0.6em 0.6em 2.6em;
+       background-repeat: no-repeat;
+       background-position: 0.5em 0.7em;
+       border: 1px solid;
+       color: #000000;
+}
+
+.message-warning {
+       background-image: url("../gfx/warning.png");
+       background-color: #fbffb3;
+       border-color: #c4b70d;
+}
\ No newline at end of file
diff --git a/typo3/gfx/installbackground.jpg b/typo3/gfx/installbackground.jpg
new file mode 100644 (file)
index 0000000..ca81781
Binary files /dev/null and b/typo3/gfx/installbackground.jpg differ
diff --git a/typo3/gfx/installlogo.gif b/typo3/gfx/installlogo.gif
new file mode 100644 (file)
index 0000000..d11cde8
Binary files /dev/null and b/typo3/gfx/installlogo.gif differ
index c6f4895..6e89335 100755 (executable)
@@ -47,9 +47,10 @@ if (defined('E_DEPRECATED')) {
 }
 
 $PATH_thisScript = str_replace('//','/', str_replace('\\','/', (PHP_SAPI=='cgi'||PHP_SAPI=='isapi' ||PHP_SAPI=='cgi-fcgi')&&($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? ($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):($_SERVER['ORIG_SCRIPT_FILENAME']?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME'])));
+$PATH_site = dirname(dirname(dirname($PATH_thisScript)));
 
        // Only allow Install Tool access if the file "typo3conf/ENABLE_INSTALL_TOOL" is found
-$enableInstallToolFile = dirname(dirname(dirname($PATH_thisScript))).'/typo3conf/ENABLE_INSTALL_TOOL';
+$enableInstallToolFile = $PATH_site . '/typo3conf/ENABLE_INSTALL_TOOL';
 
 if (is_file($enableInstallToolFile) && (time() - filemtime($enableInstallToolFile) > 3600)) {
        $content = file_get_contents($enableInstallToolFile);
@@ -63,17 +64,54 @@ if (is_file($enableInstallToolFile) && (time() - filemtime($enableInstallToolFil
 
        // 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)) {
-       die(nl2br('<strong>The Install Tool is locked.</strong>
-
-               Fix: Create a file typo3conf/ENABLE_INSTALL_TOOL
-               This file may simply be empty.
-
-               For security reasons, it is highly recommended to rename
-               or delete the file after the operation is finished.
-
-               <strong>If the file is older than 1 hour TYPO3 has automatically
-               deleted it, so it needs to be created again.</strong>
-       '));
+               // 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');
+               // Get the referer to define if this is called from backend or stand alone
+       $referer = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
+               // Define body class when stand alone
+       if (!strpos($referer['path'], 'backend.php')) {
+               $bodyClass = 'class="standalone"';
+       }
+               // Define the stylesheet
+       $stylesheet = '<link rel="stylesheet" type="text/css" href="' .
+               '../css/install.css" />';
+               // Get the template file
+       $template = @file_get_contents($PATH_site . '/typo3/templates/install.html');
+               // Define the markers content
+       $markers = array(
+               'bodyClass' => $bodyClass,
+               'styleSheet' => $stylesheet,
+               'title' => 'The install tool is locked',
+               'content' => '
+                       <p>
+                               Fix: Create a file named <strong>ENABLE_INSTALL_TOOL</strong>
+                               and put it into the folder <strong>typo3conf/</strong>
+                               <br />
+                               This file may simply be empty.
+                       </p>
+                       <p>
+                               For security reasons, it is highly recommended to rename or
+                               delete the file after the operation is finished.
+                       </p>
+                       <p>
+                               If the file is older than 1 hour TYPO3 has automatically deleted
+                               it, so it needs to be created again.
+                       </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');
+       echo $content;
+       exit();
 }
 
 
diff --git a/typo3/templates/install.html b/typo3/templates/install.html
new file mode 100644 (file)
index 0000000..12960ba
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="###CHARSET###"?>
+<!DOCTYPE html
+     PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+               <title>###TITLE###</title>
+               ###STYLESHEET###
+       </head>
+       <body ###BODYCLASS###>
+               <div id="container">
+                       <h1>TYPO3</h1>
+                       <div class="typo3-message message-warning">
+                               <h2>###TITLE###</h2>
+                               ###CONTENT###
+                       </div>
+               </div>
+       </body>
+</html>
\ No newline at end of file