Index: branches/5.2.x/core/kernel/processors/main_processor.php
===================================================================
diff -u -r15137 -r15173
--- branches/5.2.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 15137)
+++ branches/5.2.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 15173)
@@ -1,6 +1,6 @@
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: branches/5.2.x/core/units/helpers/file_helper.php
===================================================================
diff -u -r15012 -r15173
--- branches/5.2.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 15012)
+++ branches/5.2.x/core/units/helpers/file_helper.php (.../file_helper.php) (revision 15173)
@@ -1,6 +1,6 @@
Application->setContentType(kUtil::mimeContentType($filename), false);
header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
header('Content-Length: ' . filesize($filename));
readfile($filename);
Index: branches/5.2.x/core/admin_templates/tree.tpl
===================================================================
diff -u -r14929 -r15173
--- branches/5.2.x/core/admin_templates/tree.tpl (.../tree.tpl) (revision 14929)
+++ branches/5.2.x/core/admin_templates/tree.tpl (.../tree.tpl) (revision 15173)
@@ -40,7 +40,7 @@
}
-
+
Index: branches/5.2.x/core/kernel/application.php
===================================================================
diff -u -r15137 -r15173
--- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 15137)
+++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 15173)
@@ -1,6 +1,6 @@
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 ? '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: branches/5.2.x/core/units/helpers/csv_helper.php
===================================================================
diff -u -r15159 -r15173
--- branches/5.2.x/core/units/helpers/csv_helper.php (.../csv_helper.php) (revision 15159)
+++ branches/5.2.x/core/units/helpers/csv_helper.php (.../csv_helper.php) (revision 15173)
@@ -1,6 +1,6 @@
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: branches/5.2.x/core/kernel/db/db_event_handler.php
===================================================================
diff -u -r15145 -r15173
--- branches/5.2.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 15145)
+++ branches/5.2.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 15173)
@@ -1,6 +1,6 @@
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: branches/5.2.x/core/units/fck/fck_eh.php
===================================================================
diff -u -r15137 -r15173
--- branches/5.2.x/core/units/fck/fck_eh.php (.../fck_eh.php) (revision 15137)
+++ branches/5.2.x/core/units/fck/fck_eh.php (.../fck_eh.php) (revision 15173)
@@ -1,6 +1,6 @@
Application->setContentType('text/xml');
// Create the XML document header.
}