Attached Files |
speed_improvements.patch [^] (1,597 bytes) 2012-03-03 11:28
[Show Content]
Index: .htaccess
===================================================================
--- .htaccess (revision 15111)
+++ .htaccess (working copy)
@@ -9,11 +9,14 @@
<IfModule mod_expires.c>
ExpiresActive on
- ExpiresByType text/css "access plus 4 hours"
- ExpiresByType application/x-javascript "access plus 4 hours"
- ExpiresByType image/gif "access plus 4 hours"
- ExpiresByType image/jpeg "access plus 4 hours"
- ExpiresByType image/png "access plus 4 hours"
+ ExpiresByType text/css "access plus 1 month"
+ ExpiresByType application/x-javascript "access plus 1 month"
+ ExpiresByType application/javascript "access plus 1 month"
+ ExpiresByType image/gif "access plus 1 month"
+ ExpiresByType image/jpeg "access plus 1 month"
+ ExpiresByType image/png "access plus 1 month"
+ ExpiresByType image/x-icon "access plus 1 month"
+ ExpiresByType image/icon "access plus 1 month"
</IfModule>
## Enable mod-rewrite
Index: core/kernel/application.php
===================================================================
--- core/kernel/application.php (revision 15111)
+++ core/kernel/application.php (working copy)
@@ -1171,6 +1171,12 @@
$this->HTML = ob_get_clean() . $this->HTML;
}
+ $language =& $this->recallObject('lang.current');
+ /* @var $language LanguagesItem */
+
+ // don't replace header if some tag (e.g. XMLTemplate) already set it to something else
+ header('Content-type: text/html; charset=' . $language->GetDBField('Charset'), false);
+
if ( $this->UseOutputCompression() ) {
$compression_level = $this->ConfigValue('OutputCompressionLevel');
content_type_header_fix_core.patch [^] (5,459 bytes) 2012-03-09 06:33
[Show Content]
Index: admin_templates/tree.tpl
===================================================================
--- admin_templates/tree.tpl (revision 15165)
+++ admin_templates/tree.tpl (working copy)
@@ -40,7 +40,7 @@
}
</script>
-<script src="js/tree.js"></script>
+<script type="text/javascript" src="<inp2:m_Compress files='js/tree.js'/>"></script>
<table style="height: 100%; width: 100%; border-right: 1px solid #777; border-bottom: 1px solid #777;">
<tr>
Index: kernel/application.php
===================================================================
--- kernel/application.php (revision 15165)
+++ kernel/application.php (working copy)
@@ -1173,12 +1173,8 @@
$this->HTML = ob_get_clean() . $this->HTML;
}
- $language = $this->recallObject('lang.current');
- /* @var $language LanguagesItem */
+ $this->setContentType();
- // don't replace header if some tag (e.g. XMLTemplate) already set it to something else
- header('Content-type: text/html; charset=' . $language->GetDBField('Charset'), false);
-
if ( $this->UseOutputCompression() ) {
$compression_level = $this->ConfigValue('OutputCompressionLevel');
@@ -3001,7 +2997,7 @@
$lang = $this->recallObject('lang.current');
/* @var $lang LanguagesItem */
- header('Content-type: text/xml; charset=' . $lang->GetDBField('Charset'));
+ $this->setContentType('text/xml');
return $xml_version ? '<?xml version="' . $xml_version . '" encoding="' . $lang->GetDBField('Charset') . '"?>' : '';
}
@@ -3129,4 +3125,37 @@
return MaintenanceMode::NONE;
}
+
+ /**
+ * Sets content type of the page
+ *
+ * @param string $content_type
+ * @param bool $include_charset
+ * @return void
+ * @access public
+ */
+ public function setContentType($content_type = 'text/html', $include_charset = null)
+ {
+ static $aleady_set = false;
+
+ if ( $aleady_set ) {
+ return;
+ }
+
+ $header = 'Content-type: ' . $content_type;
+
+ if ( !isset($include_charset) ) {
+ $include_charset = $content_type = 'text/html' || $content_type = 'text/xml';
+ }
+
+ if ( $include_charset ) {
+ $language = $this->recallObject('lang.current');
+ /* @var $language LanguagesItem */
+
+ $header .= '; charset=' . $language->GetDBField('Charset');
+ }
+
+ $aleady_set = true;
+ header($header);
+ }
}
\ No newline at end of file
Index: kernel/db/db_event_handler.php
===================================================================
--- kernel/db/db_event_handler.php (revision 15165)
+++ kernel/db/db_event_handler.php (working copy)
@@ -3227,7 +3227,7 @@
}
header('Content-Length: ' . filesize($path));
- header('Content-Type: ' . kUtil::mimeContentType($path));
+ $this->Application->setContentType(kUtil::mimeContentType($path), false);
header('Content-Disposition: inline; filename="' . $file . '"');
readfile($path);
@@ -3359,8 +3359,7 @@
{
$event->status = kEvent::erSTOP;
- /*$lang = $this->Application->recallObject('lang.current');
- header('Content-type: text/xml; charset=' . $lang->GetDBField('Charset'));*/
+// $this->Application->setContentType('text/xml');
$picker_helper = $this->Application->recallObject('ColumnPickerHelper');
/* @var $picker_helper kColumnPickerHelper */
Index: kernel/processors/main_processor.php
===================================================================
--- kernel/processors/main_processor.php (revision 15165)
+++ kernel/processors/main_processor.php (working copy)
@@ -1064,11 +1064,6 @@
return $this->Application->XMLHeader(getArrayValue($params, 'xml_version'));
}
- $lang = $this->Application->recallObject('lang.current');
- /* @var $lang LanguagesItem */
-
- header('Content-type: text/html; charset=' . $lang->GetDBField('Charset'));
-
return '';
}
Index: units/fck/fck_eh.php
===================================================================
--- units/fck/fck_eh.php (revision 15165)
+++ units/fck/fck_eh.php (working copy)
@@ -65,7 +65,8 @@
// HTTP/1.0
header('Pragma: no-cache') ;
// Set the response format.
- header( 'Content-Type: text/xml; charset=utf-8' ) ;
+
+ $this->Application->setContentType('text/xml');
// Create the XML document header.
}
Index: units/helpers/csv_helper.php
===================================================================
--- units/helpers/csv_helper.php (revision 15165)
+++ units/helpers/csv_helper.php (working copy)
@@ -174,7 +174,7 @@
$export_data = unserialize($this->Application->RecallVar('export_data'));
$filename = preg_replace('/(.*)\.csv$/', '\1', basename($export_data['file_name'])) . '.csv';
- header('Content-type: text/csv');
+ $this->Application->setContentType('text/csv');
header('Content-Disposition: attachment; filename="' . $filename . '"');
readfile($export_data['file_name']);
die();
Index: units/helpers/file_helper.php
===================================================================
--- units/helpers/file_helper.php (revision 15165)
+++ units/helpers/file_helper.php (working copy)
@@ -255,7 +255,7 @@
*/
public function DownloadFile($filename)
{
- header('Content-type: ' . kUtil::mimeContentType($filename));
+ $this->Application->setContentType(kUtil::mimeContentType($filename), false);
header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
header('Content-Length: ' . filesize($filename));
readfile($filename);
content_type_header_fix_modules.patch [^] (3,480 bytes) 2012-03-09 06:33
[Show Content]
Index: in-auction/hitcounter.php
===================================================================
--- in-auction/hitcounter.php (revision 15165)
+++ in-auction/hitcounter.php (working copy)
@@ -28,7 +28,8 @@
$application->HandleEvent(new kEvent('l-ebay:OnHitAuction'));
$filename = MODULES_PATH . '/in-auction/admin_templates/img/s.gif';
- header('Content-type: image/gif');
+
+ $application->setContentType('image/gif');
header('Content-length: '.filesize($filename));
readfile($filename);
$application->Done();
Index: in-auction/units/listing/listing_eh.php
===================================================================
--- in-auction/units/listing/listing_eh.php (revision 15165)
+++ in-auction/units/listing/listing_eh.php (working copy)
@@ -1304,7 +1304,7 @@
}
$ChartHelper = $this->Application->recallObject('ChartHelper');
- header("Content-type: image/png");
+ $this->Application->setContentType('image/png');
$width = $this->Application->GetVar('width');
if ($width == 0)
@@ -1396,7 +1396,7 @@
$ret = str_replace('<tab>',',', $ret);
$ret = str_replace('<cr>',"\r", $ret);
- header("Content-type: application/txt");
+ $this->Application->setContentType('application/txt');
header("Content-length: ".(string)strlen($ret));
header("Content-Disposition: attachment; filename=\"".html_entity_decode('eBaySalesReport-'.date('d-M-Y').'.csv')."\"");
header("Pragma: no-cache"); //some IE-fixing stuff
Index: in-commerce/units/downloads/download_helper.php
===================================================================
--- in-commerce/units/downloads/download_helper.php (revision 15165)
+++ in-commerce/units/downloads/download_helper.php (working copy)
@@ -43,7 +43,7 @@
function DoSendFile($file_info)
{
- header('Content-type: ' . kUtil::mimeContentType($file_info['real_path']));
+ $this->Application->setContentType(kUtil::mimeContentType($file_info['real_path']), false);
header('Content-Disposition: attachment; filename="' . $file_info['FilePath'] . '"');
header('Content-Length: ' . filesize($file_info['real_path']));
Index: in-commerce/units/orders/orders_event_handler.php
===================================================================
--- in-commerce/units/orders/orders_event_handler.php (revision 15165)
+++ in-commerce/units/orders/orders_event_handler.php (working copy)
@@ -3930,7 +3930,7 @@
return;
}
- header('Content-type: ' . kUtil::mimeContentType($full_path));
+ $this->Application->setContentType(kUtil::mimeContentType($full_path), false);
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile($full_path);
}
Index: in-commerce/units/reports/reports_event_handler.php
===================================================================
--- in-commerce/units/reports/reports_event_handler.php (revision 15165)
+++ in-commerce/units/reports/reports_event_handler.php (working copy)
@@ -655,7 +655,7 @@
$ChartHelper = $this->Application->recallObject('ChartHelper');
- header("Content-type: image/png");
+ $this->Application->setContentType('image/png');
$width = $event->getEventParam('width');
if (!$width) {
@@ -693,7 +693,7 @@
{
$ChartHelper = $this->Application->recallObject('ChartHelper');
- header("Content-type: image/png");
+ $this->Application->setContentType('image/png');
$width = $this->Application->GetVar('width');
if ($width == 0)
|