Project

General

Profile

Feature #19717 » 9974_v2.diff

Administrator Admin, 2009-02-01 15:30

View differences:

typo3/sysext/cms/tslib/index_ts.php (working copy)
if (!@is_dir(PATH_typo3conf)) die('Cannot find configuration. This file is probably executed from the wrong location.');
// *********************
// Prevent any output until AJAX/compression is initialized to stop
// AJAX/compression data corruption
// *********************
ob_start();
// *********************
// Timetracking started
// *********************
require_once(PATH_t3lib.'class.t3lib_timetrack.php');
......
// *********************
if ($temp_extId = t3lib_div::_GP('eID')) {
if ($classPath = t3lib_div::getFileAbsFileName($TYPO3_CONF_VARS['FE']['eID_include'][$temp_extId])) {
// Remove any output produced until now
ob_clean();
require_once(PATH_tslib.'class.tslib_eidtools.php');
require($classPath);
}
......
// *******************
// output compression
// Output compression
// *******************
if ($TYPO3_CONF_VARS['FE']['compressionLevel']) {
ob_start();
require_once(PATH_t3lib.'class.gzip_encode.php');
// Remove any output produced until now
ob_clean();
if ($TYPO3_CONF_VARS['FE']['compressionLevel'] && extension_loaded('zlib')) {
if (t3lib_div::testInt($TYPO3_CONF_VARS['FE']['compressionLevel'])) {
// Prevent errors if ini_set() is unavailable (safe mode)
@ini_set('zlib.output_compression_level', $TYPO3_CONF_VARS['FE']['compressionLevel']);
}
ob_start('typo3CompressionOutputHandler');
}
// *********
......
t3lib_div::devLog('END of FRONTEND session', 'cms', 0, array('_FLUSH' => TRUE));
}
/**
* Corrects HTTP "Content-length" header if it was sent by TYPO3 and compression
* is enabled.
*
* @param string $outputBuffer Output buffer to compress
* @param int $mode One of PHP_OUTPUT_HANDLER_xxx contants
* @return string Compressed string
* @see ob_start()
* @see ob_gzhandler()
*/
function typo3CompressionOutputHandler($outputBuffer, $mode) {
static $contentLength = 0;
// *************
// Compressions
// *************
if ($TYPO3_CONF_VARS['FE']['compressionLevel']) {
new gzip_encode($TYPO3_CONF_VARS['FE']['compressionLevel'], false, $TYPO3_CONF_VARS['FE']['compressionDebugInfo']);
// Compress the content
$outputBuffer = ob_gzhandler($outputBuffer, $mode);
if ($outputBuffer !== false) {
// Save compressed size
$contentLength += strlen($outputBuffer);
// Check if this was the last content chunk
if (0 != ($mode & PHP_OUTPUT_HANDLER_END)) {
// Check if we have content-length header
foreach (headers_list() as $header) {
if (0 == strncasecmp('Content-length:', $header, 15)) {
header('Content-length: ' . $contentLength);
break;
}
}
}
}
return $outputBuffer;
}
?>
t3lib/config_default.php (working copy)
'strictFormmail' => TRUE, // Boolean. If set, the internal "formmail" feature in TYPO3 will send mail ONLY to recipients which has been encoded by the system itself. This protects against spammers misusing the formmailer.
'secureFormmail' => TRUE, // Boolean. If set, the internal "formmail" feature in TYPO3 will send mail ONLY to the recipients that are defined in the form CE record. This protects against spammers misusing the formmailer.
'formmailMaxAttachmentSize' => 250000, // Integer. Sets the maximum allowed size (in bytes) of attachments for the internal "formmail" feature.
'compressionLevel' => 0, // Determines output compression of FE output. Makes output smaller but slows down the page generation depending on the compression level. Requires zlib in your PHP4 installation. Range 1-9, where 1 is least compression (approx. 50%) and 9 is greatest compression (approx 33%). 'true' as value will set the compression based on the system load (works with Linux, FreeBSD). Suggested value is 3. For more info, see class in t3lib/class.gzip_encode.php written by Sandy McArthur, Jr. <Leknor@Leknor.com>
'compressionDebugInfo' => 0, // Boolean. If set, then in the end of the pages, the sizes of the compressed and non-compressed document is output. This should be used ONLY as a test, because the content is compressed twice in order to output this statistics!
'compressionLevel' => 0, // Determines output compression of FE output. Makes output smaller but slows down the page generation depending on the compression level. Requires zlib in your PHP installation. Range 1-9, where 1 is least compression and 9 is greatest compression. 'true' as value will set the compression based on the PHP default settings (usually 5). Suggested and most optimal value is 5.
'pageNotFound_handling' => '', // How TYPO3 should handle requests for non-existing/accessible pages. false (default): The 'nearest' page is shown. TRUE or '1': An TYPO3 error box is displayed. Strings: page to show (reads content and outputs with correct headers), eg. 'notfound.html' or 'http://www.domain.org/errors/notfound.html'. If prefixed "REDIRECT:" it will redirect to the URL/script after the prefix (original behaviour). If prefixed with "READFILE:" then it will expect the remaining string to be a HTML file which will be read and outputted directly after having the marker "###CURRENT_URL###" substituted with REQUEST_URI and ###REASON### with reason text, for example: "READFILE:fileadmin/notfound.html". Another option is the prefix "USER_FUNCTION:" which will call a user function, eg. "USER_FUNCTION:typo3conf/pageNotFoundHandling.php:user_pageNotFound->pageNotFound" where the file must contain a class "user_pageNotFound" with a method "pageNotFound" inside with two parameters, $param and $ref
'pageNotFound_handling_statheader' => 'HTTP/1.0 404 Not Found', // If 'pageNotFound_handling' is enabled, this string will always be sent as header before the actual handling.
'pageNotFoundOnCHashError' => 0, // Boolean. If true, a page not found call is made when cHash evaluation error occurs. By default they will just disable caching but still display page output.
(1-1/2)