TYPO3 API  SVNRelease
index.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Starter-script for install screen
00029  *
00030  * $Id: index.php 10121 2011-01-18 20:15:30Z ohader $
00031  *
00032  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00033  * @package TYPO3
00034  * @subpackage core
00035  */
00036 
00037 
00038 
00039 // **************************************************************************
00040 // Insert some security here, if you don't trust the Install Tool Password:
00041 // **************************************************************************
00042 
00043 if (defined('E_DEPRECATED')) {
00044     error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
00045 } else {
00046     error_reporting(E_ALL ^ E_NOTICE);
00047 }
00048 
00049 $PATH_thisScript = str_replace('//', '/', str_replace('\\', '/',
00050     (PHP_SAPI == 'fpm-fcgi' || PHP_SAPI == 'cgi' || PHP_SAPI == 'isapi' || PHP_SAPI == 'cgi-fcgi') &&
00051     ($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) ?
00052     ($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) :
00053     ($_SERVER['ORIG_SCRIPT_FILENAME'] ? $_SERVER['ORIG_SCRIPT_FILENAME'] : $_SERVER['SCRIPT_FILENAME'])));
00054 
00055 $PATH_site = dirname(dirname(dirname($PATH_thisScript)));
00056 
00057 $quickstartFile = $PATH_site . '/typo3conf/FIRST_INSTALL';
00058 $enableInstallToolFile = $PATH_site . '/typo3conf/ENABLE_INSTALL_TOOL';
00059 
00060     // If typo3conf/FIRST_INSTALL is present and can be deleted, automatically create typo3conf/ENABLE_INSTALL_TOOL
00061 if (is_file($quickstartFile) && is_writeable($quickstartFile) && unlink($quickstartFile)) {
00062     touch($enableInstallToolFile);
00063 }
00064 
00065     // Only allow Install Tool access if the file "typo3conf/ENABLE_INSTALL_TOOL" is found
00066 if (is_file($enableInstallToolFile) && (time() - filemtime($enableInstallToolFile) > 3600)) {
00067     $content = file_get_contents($enableInstallToolFile);
00068     $verifyString = 'KEEP_FILE';
00069 
00070     if (trim($content) !== $verifyString) {
00071             // Delete the file if it is older than 3600s (1 hour)
00072         unlink($enableInstallToolFile);
00073     }
00074 }
00075 
00076     // Change 1==2 to 1==1 if you want to lock the Install Tool regardless of the file ENABLE_INSTALL_TOOL
00077 if (1==2 || !is_file($enableInstallToolFile)) {
00078         // Include t3lib_div and t3lib_parsehtml for templating
00079     require_once($PATH_site . '/t3lib/class.t3lib_div.php');
00080     require_once($PATH_site . '/t3lib/class.t3lib_parsehtml.php');
00081 
00082         // Define the stylesheet
00083     $stylesheet = '<link rel="stylesheet" type="text/css" href="' .
00084         '../stylesheets/install/install.css" />';
00085     $javascript = '<script type="text/javascript" src="' .
00086         '../contrib/prototype/prototype.js"></script>' . LF;
00087     $javascript .= '<script type="text/javascript" src="' .
00088         '../sysext/install/Resources/Public/Javascript/install.js"></script>';
00089 
00090         // Get the template file
00091     $template = @file_get_contents($PATH_site . '/typo3/templates/install.html');
00092         // Define the markers content
00093     $markers = array(
00094         'styleSheet' => $stylesheet,
00095         'javascript' => $javascript,
00096         'title' => 'The Install Tool is locked',
00097         'content' => '
00098             <p>
00099                 To enable the Install Tool, the file ENABLE_INSTALL_TOOL must be created.
00100             </p>
00101             <ul>
00102                 <li>
00103                     In the typo3conf/ folder, create a file named ENABLE_INSTALL_TOOL. The file name is
00104                     case sensitive, but the file itself can simply be an empty file.
00105                 </li>
00106                 <li class="t3-install-locked-user-settings">
00107                     Alternatively, in the Backend, go to <a href="javascript:top.goToModule(\'user_setup\',1);">User tools &gt; User settings</a>
00108                     and let TYPO3 create this file for you. When you\'re finished, you can also visit
00109                     <a href="javascript:top.goToModule(\'user_setup\',1);">User tools &gt; User settings</a> and delete the file from there.
00110                 </li>
00111             </ul>
00112             <p>
00113                 For security reasons, it is highly recommended that you either rename or delete the file after the operation is finished.
00114             </p>
00115             <p>
00116                 As an additional security measure, if the file is older than one hour, TYPO3 will automatically delete it.
00117             </p>
00118         '
00119     );
00120         // Fill the markers
00121     $content = t3lib_parsehtml::substituteMarkerArray(
00122         $template,
00123         $markers,
00124         '###|###',
00125         1,
00126         1
00127     );
00128         // Output the warning message and exit
00129     header('Content-Type: text/html; charset=utf-8');
00130     header('Cache-Control: no-cache, must-revalidate');
00131     header('Pragma: no-cache');
00132     echo $content;
00133     exit();
00134 }
00135 
00136 
00137 
00138 // *****************************************************************************
00139 // Defining constants necessary for the install-script to invoke the installer
00140 // *****************************************************************************
00141 define('TYPO3_MOD_PATH', 'install/');
00142 $BACK_PATH='../';
00143 
00144     // Defining this variable and setting it non-false will invoke the install-screen called from init.php
00145 define('TYPO3_enterInstallScript', '1');
00146 require ('../init.php');
00147 
00148 ?>