aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoromniError <omniError@github>2014-07-13 14:01:50 -0500
committeromniError <omniError@github>2014-08-01 15:27:17 -0500
commita7794b765cb16589155a53ebdd4cda1120c565ab (patch)
tree8ab610521cf867307e28e41175dd651592eebe9c
parentaadcbb765aaf5fd863752a255c5dd8afd8302721 (diff)
downloadforums-a7794b765cb16589155a53ebdd4cda1120c565ab.tar
forums-a7794b765cb16589155a53ebdd4cda1120c565ab.tar.gz
forums-a7794b765cb16589155a53ebdd4cda1120c565ab.tar.bz2
forums-a7794b765cb16589155a53ebdd4cda1120c565ab.tar.xz
forums-a7794b765cb16589155a53ebdd4cda1120c565ab.zip
[ticket/12831] Optn to prevent setting HTTP headers
https://tracker.phpbb.com/browse/PHPBB3-12831 PHPBB3-12831
-rw-r--r--phpBB/includes/functions.php29
-rw-r--r--phpBB/includes/functions_acp.php29
2 files changed, 43 insertions, 15 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 158bf1cbc0..e9f3ce59bd 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -5030,6 +5030,9 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
'SITE_LOGO_IMG' => $user->img('site_logo'),
));
+ // A listener can set this variable to `false` when it wants to prevent setting of headers
+ $page_header_set_headers = true;
+
/**
* Execute code and/or overwrite _common_ template variables after they have been assigned.
*
@@ -5040,23 +5043,29 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
* session item, e.g. forum for
* session_forum_id
* @var int item_id Restrict online users to item id
+ * @var bool page_header_set_headers Set to false if phpBB should not
+ * set HTTP headers (since you have
+ * set them elsewhere).
*
* @since 3.1.0-b3
*/
- $vars = array('page_title', 'display_online_list', 'item_id', 'item');
+ $vars = array('page_title', 'display_online_list', 'item_id', 'item', 'page_header_set_headers');
extract($phpbb_dispatcher->trigger_event('core.page_header_after', compact($vars)));
- // application/xhtml+xml not used because of IE
- header('Content-type: text/html; charset=UTF-8');
+ if ($page_header_set_headers)
+ {
+ // application/xhtml+xml not used because of IE
+ header('Content-type: text/html; charset=UTF-8');
- header('Cache-Control: private, no-cache="set-cookie"');
- header('Expires: 0');
- header('Pragma: no-cache');
+ header('Cache-Control: private, no-cache="set-cookie"');
+ header('Expires: 0');
+ header('Pragma: no-cache');
- if (!empty($user->data['is_bot']))
- {
- // Let reverse proxies know we detected a bot.
- header('X-PHPBB-IS-BOT: yes');
+ if (!empty($user->data['is_bot']))
+ {
+ // Let reverse proxies know we detected a bot.
+ header('X-PHPBB-IS-BOT: yes');
+ }
}
return;
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 8453da6e6e..ce020fbdf1 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -107,12 +107,31 @@ function adm_page_header($page_title)
'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left',
));
- // application/xhtml+xml not used because of IE
- header('Content-type: text/html; charset=UTF-8');
+ // A listener can set this variable to `false` when it wants to prevent setting of headers
+ $adm_page_header_set_headers = true;
- header('Cache-Control: private, no-cache="set-cookie"');
- header('Expires: 0');
- header('Pragma: no-cache');
+ /**
+ * Execute code and/or overwrite _common_ template variables after they have been assigned.
+ *
+ * @event core.adm_page_header_after
+ * @var string page_title Page title
+ * @var bool adm_page_header_set_headers Set to false if phpBB should not
+ * set HTTP headers (useful for integrators).
+ *
+ * @since 3.1.0-RC3
+ */
+ $vars = array('page_title', 'adm_page_header_set_headers');
+ extract($phpbb_dispatcher->trigger_event('core.adm_page_header_after', compact($vars)));
+
+ if ($adm_page_header_set_headers)
+ {
+ // application/xhtml+xml not used because of IE
+ header('Content-type: text/html; charset=UTF-8');
+
+ header('Cache-Control: private, no-cache="set-cookie"');
+ header('Expires: 0');
+ header('Pragma: no-cache');
+ }
return;
}