Page MenuHomeIn-Portal Phabricator

D525.diff
No OneTemporary

File Metadata

Created
Thu, Jul 3, 12:05 AM

D525.diff

Index: core/admin_templates/site_domains/site_domain_edit.tpl
===================================================================
--- core/admin_templates/site_domains/site_domain_edit.tpl
+++ core/admin_templates/site_domains/site_domain_edit.tpl
@@ -77,6 +77,7 @@
<inp2:m_RenderElement name="inp_id_label" prefix="site-domain" field="DomainId" title="la_fld_Id"/>
<inp2:m_RenderElement name="inp_edit_regexp_box" prefix="site-domain" field="DomainName" title="la_fld_DomainName"/>
<inp2:m_RenderElement name="inp_edit_regexp_box" prefix="site-domain" field="SSLUrl"/>
+ <inp2:m_RenderElement name="inp_edit_textarea" prefix="site-domain" field="ExtraHTTPHeaders" control_options="{max_height: 100}"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="site-domain" field="AdminEmail" title="la_fld_AdminEmail"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="site-domain" field="Country" title="la_fld_Country" has_empty="1"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="site-domain" field="PrimaryLanguageId" title="la_fld_Language" has_empty="1"/>
Index: core/install/english.lang
===================================================================
--- core/install/english.lang
+++ core/install/english.lang
@@ -173,6 +173,7 @@
<PHRASE Label="la_config_EnablePageContentRevisionControl" Module="Core" Type="1">RW5hYmxlIFJldmlzaW9uIENvbnRyb2wgZm9yIFNlY3Rpb24gQ29udGVudA==</PHRASE>
<PHRASE Label="la_config_error_template" Module="Core" Type="1">VGVtcGxhdGUgZm9yICJGaWxlIG5vdCBmb3VuZCAoNDA0KSIgRXJyb3I=</PHRASE>
<PHRASE Label="la_config_ExcludeTemplateSectionsFromSearch" Module="Core" Type="1">RXhjbHVkZSB0ZW1wbGF0ZSBiYXNlZCBTZWN0aW9ucyBmcm9tIFNlYXJjaCBSZXN1bHRzIChpZS4gVXNlciBSZWdpc3RyYXRpb24p</PHRASE>
+ <PHRASE Label="la_config_ExtraHTTPHeaders" Module="Core" Type="1" Hint="T25lIGhlYWRlciBwZXIgbGluZSBpbiDigJxoZWFkZXItbmFtZTogaGVhZGVyIHZhbHVl4oCdIGZvcm1hdCAod2l0aG91dCBxdW90ZXMp">RXh0cmEgSFRUUCBIZWFkZXJz</PHRASE>
<PHRASE Label="la_config_FilenameSpecialCharReplacement" Module="Core" Type="1">RmlsZW5hbWUgU3BlY2lhbCBDaGFyIFJlcGxhY2VtZW50</PHRASE>
<PHRASE Label="la_config_first_day_of_week" Module="Core" Type="1">Rmlyc3QgRGF5IE9mIFdlZWs=</PHRASE>
<PHRASE Label="la_config_ForceImageMagickResize" Module="Core" Type="1">QWx3YXlzIHVzZSBJbWFnZU1hZ2ljayB0byByZXNpemUgaW1hZ2Vz</PHRASE>
@@ -441,6 +442,7 @@
<PHRASE Label="la_fld_ExternalLink" Module="Core" Type="1" Column="RXh0ZXJuYWwgTGluaw==">RXh0ZXJuYWwgTGluaw==</PHRASE>
<PHRASE Label="la_fld_ExternalUrl" Module="Core" Type="1">RXh0ZXJuYWwgVVJM</PHRASE>
<PHRASE Label="la_fld_ExtraHeaders" Module="Core" Type="1">RXh0cmEgSGVhZGVycw==</PHRASE>
+ <PHRASE Label="la_fld_ExtraHTTPHeaders" Module="Core" Type="1" Column="RXh0cmEgSFRUUCBIZWFkZXJz">RXh0cmEgSFRUUCBIZWFkZXJz</PHRASE>
<PHRASE Label="la_fld_Fax" Module="Core" Type="1" Column="RmF4">RmF4</PHRASE>
<PHRASE Label="la_fld_FieldComparision" Module="Core" Type="1" Column="TWF0Y2ggVHlwZQ==">TWF0Y2ggVHlwZQ==</PHRASE>
<PHRASE Label="la_fld_FieldName" Module="Core" Type="1" Column="RmllbGQgTmFtZQ==">RmllbGQgTmFtZQ==</PHRASE>
Index: core/install/install_data.sql
===================================================================
--- core/install/install_data.sql
+++ core/install/install_data.sql
@@ -101,6 +101,7 @@
INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemTagCache', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_syscache_enable', 'checkbox', NULL, NULL, 60.08, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SocketBlockingMode', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_socket_blocking_mode', 'checkbox', NULL, NULL, 60.09, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SemaphoreLifetimeInSeconds', '300', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_SemaphoreLifetimeInSeconds', 'text', '', 'style=\"width: 50px;\"', 60.1, 0, 1, 'hint:la_config_SemaphoreLifetimeInSeconds');
+INSERT INTO SystemSettings VALUES(DEFAULT, 'ExtraHTTPHeaders', 'X-Content-Type-Options: nosniff\nX-Frame-Options: sameorigin', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_ExtraHTTPHeaders', 'textarea', '', 'style=\"width: 100%; height: 100px;\"', 60.11, 0, 1, 'hint:la_config_ExtraHTTPHeaders');
INSERT INTO SystemSettings VALUES(DEFAULT, 'EnableEmailLog', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EnableEmailLog', 'radio', NULL, '1=la_Yes||0=la_No', 65.01, 0, 1, 'hint:la_config_EnableEmailLog');
INSERT INTO SystemSettings VALUES(DEFAULT, 'EmailLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EmailLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_EmailLogKeepForever', 65.02, 0, 0, 'hint:la_config_EmailLogRotationInterval');
INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SystemLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_SystemLogKeepForever', 65.03, 0, 1, 'hint:la_config_SystemLogRotationInterval');
Index: core/install/install_schema.sql
===================================================================
--- core/install/install_schema.sql
+++ core/install/install_schema.sql
@@ -1325,6 +1325,7 @@
DomainNameUsesRegExp tinyint(4) NOT NULL DEFAULT '0',
SSLUrl varchar(255) NOT NULL DEFAULT '',
SSLUrlUsesRegExp tinyint(4) NOT NULL DEFAULT '0',
+ ExtraHTTPHeaders text,
AdminEmail varchar(255) NOT NULL DEFAULT '',
DefaultEmailRecipients text,
Country varchar(3) NOT NULL DEFAULT '',
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql
+++ core/install/upgrades.sql
@@ -2986,3 +2986,6 @@
UPDATE UserSessionLogs SET SessionKey = SessionId;
ALTER TABLE CurlLog CHANGE `SessionKey` `SessionKey` char(64) NOT NULL DEFAULT '';
ALTER TABLE SystemLog CHANGE `LogSessionKey` `LogSessionKey` char(64) NOT NULL DEFAULT '';
+
+INSERT INTO SystemSettings VALUES(DEFAULT, 'ExtraHTTPHeaders', 'X-Content-Type-Options: nosniff\nX-Frame-Options: sameorigin', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_ExtraHTTPHeaders', 'textarea', '', 'style=\"width: 100%; height: 100px;\"', 60.11, 0, 1, 'hint:la_config_ExtraHTTPHeaders');
+ALTER TABLE SiteDomains ADD COLUMN `ExtraHTTPHeaders` text NULL AFTER `SSLUrlUsesRegExp`;
Index: core/kernel/application.php
===================================================================
--- core/kernel/application.php
+++ core/kernel/application.php
@@ -1227,6 +1227,18 @@
echo $this->HTML;
}
+ $extra_headers = $this->siteDomainField('ExtraHTTPHeaders');
+
+ if ( empty($extra_headers) ) {
+ $extra_headers = $this->ConfigValue('ExtraHTTPHeaders');
+ }
+
+ if ( $extra_headers ) {
+ foreach ( explode("\n", $extra_headers) as $extra_header ) {
+ header($extra_header);
+ }
+ }
+
// send headers to tell the browser to close the connection
header('Content-Length: ' . ob_get_length());
header('Connection: close');
Index: core/units/site_domains/site_domains_config.php
===================================================================
--- core/units/site_domains/site_domains_config.php
+++ core/units/site_domains/site_domains_config.php
@@ -98,6 +98,7 @@
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
+ 'ExtraHTTPHeaders' => array('type' => 'string', 'default' => null),
'AdminEmail' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'DefaultEmailRecipients' => Array ('type' => 'string', 'default' => NULL),
'Country' => Array (
@@ -154,4 +155,4 @@
),
),
),
-);
\ No newline at end of file
+);

Event Timeline