From 33b20636804f00786e2a2aabf4b5155ac78269f6 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 17 Sep 2014 10:52:19 +0200 Subject: [PATCH 1/5] [ticket/13044] Correct Expires headers PHPBB3-13044 --- phpBB/feed.php | 2 +- phpBB/includes/functions.php | 2 +- phpBB/includes/functions_acp.php | 2 +- phpBB/includes/functions_download.php | 4 ++-- phpBB/install/index.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 8971bae768..68cb7b9844 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -164,7 +164,7 @@ if (defined('DEBUG') && request_var('explain', 0) && $auth->acl_get('a_')) { header('Content-type: text/html; charset=UTF-8'); header('Cache-Control: private, no-cache="set-cookie"'); - header('Expires: 0'); + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time())); header('Pragma: no-cache'); $mtime = explode(' ', microtime()); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 7dfaea6f48..3387943701 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5062,7 +5062,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = // application/xhtml+xml not used because of IE 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', - 'Expires' => '0', + 'Expires' => gmdate('D, d M Y H:i:s \G\M\T', time()), 'Pragma' => 'no-cache', ); if (!empty($user->data['is_bot'])) diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index d9dc11239c..63d13fb37c 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -112,7 +112,7 @@ function adm_page_header($page_title) // application/xhtml+xml not used because of IE 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', - 'Expires' => '0', + 'Expires' => gmdate('D, d M Y H:i:s \G\M\T', time()), 'Pragma' => 'no-cache', ); diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 4ff3994f4c..93f3951ad8 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -56,7 +56,7 @@ function send_avatar_to_browser($file, $browser) if (strpos(strtolower($browser), 'msie 6.0') !== false) { - header('Expires: -1'); + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time())); } else { @@ -197,7 +197,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) { - header('expires: -1'); + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time())); } } else diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 2e497da3db..7a2322629f 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -445,7 +445,7 @@ class module header('Content-type: text/html; charset=UTF-8'); header('Cache-Control: private, no-cache="set-cookie"'); - header('Expires: 0'); + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time())); header('Pragma: no-cache'); return; From 7cbd9e952472360f65f661d590bc95ce83a77458 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 17 Sep 2014 11:15:24 +0200 Subject: [PATCH 2/5] [ticket/13044] move GMT string out of gmdate() PHPBB3-13044 --- phpBB/feed.php | 2 +- phpBB/includes/functions.php | 2 +- phpBB/includes/functions_acp.php | 2 +- phpBB/includes/functions_download.php | 4 ++-- phpBB/install/index.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 68cb7b9844..d4dfb15928 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -164,7 +164,7 @@ if (defined('DEBUG') && request_var('explain', 0) && $auth->acl_get('a_')) { header('Content-type: text/html; charset=UTF-8'); header('Cache-Control: private, no-cache="set-cookie"'); - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time())); + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); header('Pragma: no-cache'); $mtime = explode(' ', microtime()); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3387943701..7a277055be 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5062,7 +5062,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = // application/xhtml+xml not used because of IE 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', - 'Expires' => gmdate('D, d M Y H:i:s \G\M\T', time()), + 'Expires' => gmdate('D, d M Y H:i:s', time() . ' GMT'), 'Pragma' => 'no-cache', ); if (!empty($user->data['is_bot'])) diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index 63d13fb37c..85225e761a 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -112,7 +112,7 @@ function adm_page_header($page_title) // application/xhtml+xml not used because of IE 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', - 'Expires' => gmdate('D, d M Y H:i:s \G\M\T', time()), + 'Expires' => gmdate('D, d M Y H:i:s', time() . ' GMT'), 'Pragma' => 'no-cache', ); diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 93f3951ad8..02dea6c113 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -56,7 +56,7 @@ function send_avatar_to_browser($file, $browser) if (strpos(strtolower($browser), 'msie 6.0') !== false) { - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time())); + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); } else { @@ -197,7 +197,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) { - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time())); + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); } } else diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 7a2322629f..5531a98c09 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -445,7 +445,7 @@ class module header('Content-type: text/html; charset=UTF-8'); header('Cache-Control: private, no-cache="set-cookie"'); - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time())); + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); header('Pragma: no-cache'); return; From ea5e46f6dd080f0f3bc70b560f2d202f38e709b9 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 17 Sep 2014 11:56:37 +0200 Subject: [PATCH 3/5] [ticket/13044] \G\M\T to GMT in whole project Note that there are more uses of "\G\M\T" in vendor files. PHPBB3-13044 --- phpBB/includes/functions_download.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 02dea6c113..3be84299f0 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -60,13 +60,13 @@ function send_avatar_to_browser($file, $browser) } else { - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); } } else { header('Content-Disposition: inline; ' . header_filename($file)); - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); } $size = @filesize($file_path); @@ -421,7 +421,7 @@ function set_modified_headers($stamp, $browser) send_status_line(304, 'Not Modified'); // seems that we need those too ... browsers header('Pragma: public'); - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); return true; } else From 3d637fea98480258db176ddd2c62b9e0b81a0ef4 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 17 Sep 2014 18:35:38 +0200 Subject: [PATCH 4/5] [ticket/13044] Move GMT out of gmdate() PHPBB3-13044 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 7a277055be..a61518401c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5062,7 +5062,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = // application/xhtml+xml not used because of IE 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', - 'Expires' => gmdate('D, d M Y H:i:s', time() . ' GMT'), + 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', 'Pragma' => 'no-cache', ); if (!empty($user->data['is_bot'])) From 3885ac90f18b86fa835985875fa651526e13b832 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 17 Sep 2014 18:38:21 +0200 Subject: [PATCH 5/5] [ticket/13044] Move GMT out of gmdate in functions_acp PHPBB3-13044 --- phpBB/includes/functions_acp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index 85225e761a..da8d756db9 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -112,7 +112,7 @@ function adm_page_header($page_title) // application/xhtml+xml not used because of IE 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', - 'Expires' => gmdate('D, d M Y H:i:s', time() . ' GMT'), + 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', 'Pragma' => 'no-cache', );