Fixed bug #10796: Click on (WS 48hour-) preview link in versioning module causes...
[Packages/TYPO3.CMS.git] / typo3 / init.php
old mode 100755 (executable)
new mode 100644 (file)
index eeb81be..b61a982
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -60,7 +60,7 @@
 // *******************************
 // Checking PHP version
 // *******************************
-if (version_compare(phpversion(), '5.1', '<')) die ('TYPO3 requires PHP 5.1.0 or higher.');
+if (version_compare(phpversion(), '5.2', '<')) die ('TYPO3 requires PHP 5.2.0 or higher.');
 
 
 // *******************************
@@ -68,6 +68,11 @@ if (version_compare(phpversion(), '5.1', '<'))       die ('TYPO3 requires PHP 5.1.0 or
 // *******************************
 error_reporting (E_ALL ^ E_NOTICE);
 
+// *******************************
+// Prevent any unwanted output that may corrupt AJAX/compression. Note: this does
+// not interfeer with "die()" or "echo"+"exit()" messages!
+// *******************************
+ob_start();
 
 // *******************************
 // Define constants
@@ -178,12 +183,15 @@ $PARSETIME_START = t3lib_div::milliseconds();             // Is set to the system time in m
        // TODO implement autoloading so that we only require stuff we really need
 require_once(PATH_t3lib . 'class.t3lib_cache.php');
 
-require_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractbackend.php');
-require_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractcache.php');
+require_once(PATH_t3lib . 'cache/backend/interfaces/interface.t3lib_cache_backend_backend.php');
+require_once(PATH_t3lib . 'cache/frontend/interfaces/interface.t3lib_cache_frontend_frontend.php');
+
+require_once(PATH_t3lib . 'cache/backend/class.t3lib_cache_backend_abstractbackend.php');
+require_once(PATH_t3lib . 'cache/frontend/class.t3lib_cache_frontend_abstractfrontend.php');
 require_once(PATH_t3lib . 'cache/class.t3lib_cache_exception.php');
 require_once(PATH_t3lib . 'cache/class.t3lib_cache_factory.php');
 require_once(PATH_t3lib . 'cache/class.t3lib_cache_manager.php');
-require_once(PATH_t3lib . 'cache/class.t3lib_cache_variablecache.php');
+require_once(PATH_t3lib . 'cache/frontend/class.t3lib_cache_frontend_variablefrontend.php');
 
 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_classalreadyloaded.php');
 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_duplicateidentifier.php');
@@ -193,8 +201,8 @@ require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidda
 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_nosuchcache.php');
 
 $typo3CacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
-$cacheFactoryClass = t3lib_div::makeInstanceClassName('t3lib_cache_Factory');
-$typo3CacheFactory = new $cacheFactoryClass($typo3CacheManager);
+$typo3CacheFactory = t3lib_div::makeInstance('t3lib_cache_Factory');
+$typo3CacheFactory->setCacheManager($typo3CacheManager);
 
 t3lib_cache::initPageCache();
 t3lib_cache::initPageSectionCache();
@@ -249,6 +257,20 @@ if ($TYPO3_CONF_VARS['BE']['adminOnly'] < 0)       {
        header('Location: http://');    // Just point us away from here...
        exit;   // ... and exit good!
 }
+if (!(defined('TYPO3_cliMode') && TYPO3_cliMode) && @is_file(PATH_typo3conf.'LOCK_BACKEND'))   {
+       if (TYPO3_PROCEED_IF_NO_USER == 2) {
+               // ajax poll for login, let him pass
+       } else {
+               $fContent = t3lib_div::getUrl(PATH_typo3conf.'LOCK_BACKEND');
+               if ($fContent)  {
+                       header('Location: '.$fContent); // Redirect
+               } else {
+                       die('Browser backend is locked for maintenance. Remove lock by removing the file "typo3conf/LOCK_BACKEND" or use CLI-scripts.'.chr(10).chr(10));
+               }
+               exit;
+       }
+
+}
 
 // **********************
 // Check IP
@@ -411,8 +433,12 @@ if (defined('TYPO3_cliMode') && TYPO3_cliMode)     {
 // ****************
 // compression
 // ****************
-if ($TYPO3_CONF_VARS['BE']['compressionLevel'])        {
-       ob_start();
-       require_once (PATH_t3lib.'class.gzip_encode.php');
+ob_clean();
+if (extension_loaded('zlib') && $TYPO3_CONF_VARS['BE']['compressionLevel'])    {
+       if (t3lib_div::testInt($TYPO3_CONF_VARS['BE']['compressionLevel'])) {
+               @ini_set('zlib.output_compression_level', $TYPO3_CONF_VARS['BE']['compressionLevel']);
+       }
+       ob_start('ob_gzhandler');
 }
+
 ?>