From fbebc2874fb7f9462b7cf2481a14166cfb906297 Mon Sep 17 00:00:00 2001 From: riadhchtara Date: Sat, 21 Apr 2012 17:43:13 +0200 Subject: [PATCH 01/14] [ticket/10820] Image downloader recognize new version of ie When a user download image attachement using ie8, the file is displayed. However, when he uses ie version greater than 8, the image is download. A changes are made to phpbb/download/file.php to solve the problem. We check now if the ie version is greater or equal to 8 and not only equal to 8 PHPBB3-10820 --- phpBB/download/file.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 3ceb1ee0cc..b942c92a1c 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -285,7 +285,7 @@ else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHME $db->sql_query($sql); } -if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && ((strpos(strtolower($user->browser), 'msie') !== false) && (strpos(strtolower($user->browser), 'msie 8.0') === false))) +if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && !is_greater_ie7($user->browser)) { wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']); file_gc(); @@ -343,8 +343,8 @@ function send_avatar_to_browser($file, $browser) $image_data = @getimagesize($file_path); header('Content-Type: ' . image_type_to_mime_type($image_data[2])); - - if (strpos(strtolower($browser), 'msie') !== false && strpos(strtolower($browser), 'msie 8.0') === false) + + if (strpos(strtolower($browser), 'msie') !== false && !is_greater_ie7($user->browser)) { header('Content-Disposition: attachment; ' . header_filename($file)); @@ -477,10 +477,9 @@ function send_file_to_browser($attachment, $upload_dir, $category) */ // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. - $is_ie8 = (strpos(strtolower($user->browser), 'msie 8.0') !== false); header('Content-Type: ' . $attachment['mimetype']); - - if ($is_ie8) + + if (is_greater_ie7($user->browser)) { header('X-Content-Type-Options: nosniff'); } @@ -492,7 +491,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) } else { - if (empty($user->browser) || (!$is_ie8 && (strpos(strtolower($user->browser), 'msie') !== false))) + if (empty($user->browser) || (!is_greater_ie7($user->browser) && (strpos(strtolower($user->browser), 'msie') !== false))) { header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) @@ -503,7 +502,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) else { header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); - if ($is_ie8 && (strpos($attachment['mimetype'], 'image') !== 0)) + if (is_greater_ie7($user->browser) && (strpos($attachment['mimetype'], 'image') !== 0)) { header('X-Download-Options: noopen'); } @@ -680,7 +679,8 @@ function set_modified_headers($stamp, $browser) { // let's see if we have to send the file at all $last_load = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime(trim($_SERVER['HTTP_IF_MODIFIED_SINCE'])) : false; - if ((strpos(strtolower($browser), 'msie 6.0') === false) && (strpos(strtolower($browser), 'msie 8.0') === false)) + + if ((strpos(strtolower($browser), 'msie 6.0') === false) && (!is_greater_ie7($user->browser))) { if ($last_load !== false && $last_load >= $stamp) { @@ -709,4 +709,9 @@ function file_gc() exit; } +function is_greater_ie7($browser) +{ + return preg_match('/msie (\d{2,3}|[89]+).[0-9.]*;/', strtolower($browser)); +} + ?> \ No newline at end of file From 80d164b12151c3b3d5eb42d1874a0a1d3b288d12 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 7 Feb 2013 23:59:46 +0530 Subject: [PATCH 02/14] [ticket/10820] proper usage of global and local variable browser PHPBB3-10820 --- phpBB/download/file.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index b942c92a1c..6764ee7eac 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -344,7 +344,7 @@ function send_avatar_to_browser($file, $browser) $image_data = @getimagesize($file_path); header('Content-Type: ' . image_type_to_mime_type($image_data[2])); - if (strpos(strtolower($browser), 'msie') !== false && !is_greater_ie7($user->browser)) + if (strpos(strtolower($browser), 'msie') !== false && !is_greater_ie7($browser)) { header('Content-Disposition: attachment; ' . header_filename($file)); @@ -680,7 +680,7 @@ function set_modified_headers($stamp, $browser) // let's see if we have to send the file at all $last_load = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime(trim($_SERVER['HTTP_IF_MODIFIED_SINCE'])) : false; - if ((strpos(strtolower($browser), 'msie 6.0') === false) && (!is_greater_ie7($user->browser))) + if ((strpos(strtolower($browser), 'msie 6.0') === false) && (!is_greater_ie7($browser))) { if ($last_load !== false && $last_load >= $stamp) { From 9236f12577087e5b800b9c23e988a671702f1a9e Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 8 Feb 2013 00:05:06 +0530 Subject: [PATCH 03/14] [ticket/10820] fix IE check function Add phpbb_ prefix to function name and return boolean value. PHPBB3-10820 --- phpBB/download/file.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 6764ee7eac..af41951c46 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -285,7 +285,7 @@ else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHME $db->sql_query($sql); } -if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && !is_greater_ie7($user->browser)) +if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && !phpbb_is_greater_ie7($user->browser)) { wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']); file_gc(); @@ -344,7 +344,7 @@ function send_avatar_to_browser($file, $browser) $image_data = @getimagesize($file_path); header('Content-Type: ' . image_type_to_mime_type($image_data[2])); - if (strpos(strtolower($browser), 'msie') !== false && !is_greater_ie7($browser)) + if (strpos(strtolower($browser), 'msie') !== false && !phpbb_is_greater_ie7($browser)) { header('Content-Disposition: attachment; ' . header_filename($file)); @@ -479,7 +479,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. header('Content-Type: ' . $attachment['mimetype']); - if (is_greater_ie7($user->browser)) + if (phpbb_is_greater_ie7($user->browser)) { header('X-Content-Type-Options: nosniff'); } @@ -491,7 +491,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) } else { - if (empty($user->browser) || (!is_greater_ie7($user->browser) && (strpos(strtolower($user->browser), 'msie') !== false))) + if (empty($user->browser) || (!phpbb_is_greater_ie7($user->browser) && (strpos(strtolower($user->browser), 'msie') !== false))) { header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) @@ -502,7 +502,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) else { header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); - if (is_greater_ie7($user->browser) && (strpos($attachment['mimetype'], 'image') !== 0)) + if (phpbb_is_greater_ie7($user->browser) && (strpos($attachment['mimetype'], 'image') !== 0)) { header('X-Download-Options: noopen'); } @@ -680,7 +680,7 @@ function set_modified_headers($stamp, $browser) // let's see if we have to send the file at all $last_load = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime(trim($_SERVER['HTTP_IF_MODIFIED_SINCE'])) : false; - if ((strpos(strtolower($browser), 'msie 6.0') === false) && (!is_greater_ie7($browser))) + if ((strpos(strtolower($browser), 'msie 6.0') === false) && (!phpbb_is_greater_ie7($browser))) { if ($last_load !== false && $last_load >= $stamp) { @@ -709,9 +709,9 @@ function file_gc() exit; } -function is_greater_ie7($browser) +function phpbb_is_greater_ie7($browser) { - return preg_match('/msie (\d{2,3}|[89]+).[0-9.]*;/', strtolower($browser)); + return (bool) preg_match('/msie (\d{2,3}|[89]+).[0-9.]*;/', strtolower($browser)); } ?> \ No newline at end of file From 875914767414da7ef7076f444542c09bd0b83c72 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 8 Feb 2013 13:58:41 +0530 Subject: [PATCH 04/14] [ticket/10820] add function docblock PHPBB3-10820 --- phpBB/download/file.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index af41951c46..abab473bf2 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -709,6 +709,10 @@ function file_gc() exit; } +/** +* Check if the browser is internet explorer version 7+ +* @returns true if ie7+ +*/ function phpbb_is_greater_ie7($browser) { return (bool) preg_match('/msie (\d{2,3}|[89]+).[0-9.]*;/', strtolower($browser)); From 07c62dd64f65551012bd942be29179cfae99d7ab Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 4 Mar 2013 22:44:19 +0530 Subject: [PATCH 05/14] [ticket/10820] remove unnecessary condition checks PHPBB3-10820 --- phpBB/download/file.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index abab473bf2..8bb77efe4d 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -344,7 +344,7 @@ function send_avatar_to_browser($file, $browser) $image_data = @getimagesize($file_path); header('Content-Type: ' . image_type_to_mime_type($image_data[2])); - if (strpos(strtolower($browser), 'msie') !== false && !phpbb_is_greater_ie7($browser)) + if (!phpbb_is_greater_ie7($browser)) { header('Content-Disposition: attachment; ' . header_filename($file)); @@ -491,7 +491,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) } else { - if (empty($user->browser) || (!phpbb_is_greater_ie7($user->browser) && (strpos(strtolower($user->browser), 'msie') !== false))) + if (empty($user->browser) || !phpbb_is_greater_ie7($user->browser)) { header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) From 364828de24c14a73d98621b545f7732c18b18a4d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 13 Apr 2013 22:48:09 +0530 Subject: [PATCH 06/14] [ticket/10820] Use singular return PHPBB3-10820 --- phpBB/download/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 8bb77efe4d..20d3e60580 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -711,7 +711,7 @@ function file_gc() /** * Check if the browser is internet explorer version 7+ -* @returns true if ie7+ +* @return true if ie7+ */ function phpbb_is_greater_ie7($browser) { From 687b04bcfc7a4dac8c53e9dbf5e7c31347d9d474 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 13 Apr 2013 22:50:37 +0530 Subject: [PATCH 07/14] [ticket/10820] simplify regex and escape dot PHPBB3-10820 --- phpBB/download/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 20d3e60580..5b274160e8 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -715,7 +715,7 @@ function file_gc() */ function phpbb_is_greater_ie7($browser) { - return (bool) preg_match('/msie (\d{2,3}|[89]+).[0-9.]*;/', strtolower($browser)); + return (bool) preg_match('/msie [^67]+\\.*;/', strtolower($browser)); } ?> \ No newline at end of file From ea7ece5d252fa8ede7d611abc812f8abc93c011d Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 27 Apr 2013 20:57:51 +0530 Subject: [PATCH 08/14] [ticket/10820] add param and return to function Add param and return in function docblock. Rename function parameter to $user_agent. PHPBB3-10820 --- phpBB/download/file.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 5b274160e8..081f18b15c 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -711,11 +711,14 @@ function file_gc() /** * Check if the browser is internet explorer version 7+ -* @return true if ie7+ +* +* @param string $user_agent User agent HTTP header +* +* @return bool true if ie7+ */ -function phpbb_is_greater_ie7($browser) +function phpbb_is_greater_ie7($user_agent) { - return (bool) preg_match('/msie [^67]+\\.*;/', strtolower($browser)); + return (bool) preg_match('/msie [^67]+\\.*;/', strtolower($user_agent)); } ?> \ No newline at end of file From 5ebebbd7190fb5e541df9956b5d58983765d931b Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 27 Apr 2013 21:33:30 +0530 Subject: [PATCH 09/14] [ticket/10820] fix docblock PHPBB3-10820 --- phpBB/download/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 081f18b15c..cba4ef3b7b 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -714,7 +714,7 @@ function file_gc() * * @param string $user_agent User agent HTTP header * -* @return bool true if ie7+ +* @return bool true if internet explorer version is greater than 7 */ function phpbb_is_greater_ie7($user_agent) { From 8f733cc658e20da74e910f3e36edcfdf86a7eba3 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 27 Apr 2013 23:24:22 +0530 Subject: [PATCH 10/14] [ticket/10820] remove unnecessary parentheses PHPBB3-10820 --- phpBB/download/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index cba4ef3b7b..f781480bb7 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -680,7 +680,7 @@ function set_modified_headers($stamp, $browser) // let's see if we have to send the file at all $last_load = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime(trim($_SERVER['HTTP_IF_MODIFIED_SINCE'])) : false; - if ((strpos(strtolower($browser), 'msie 6.0') === false) && (!phpbb_is_greater_ie7($browser))) + if (strpos(strtolower($browser), 'msie 6.0') === false && !phpbb_is_greater_ie7($browser)) { if ($last_load !== false && $last_load >= $stamp) { From 6b5780b753a857dec087d363601e54f1515213fa Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sun, 12 May 2013 16:03:48 +0530 Subject: [PATCH 11/14] [ticket/10820] fix regex Extract IE version from user agent string and then compare it with 7 PHPBB3-10820 --- phpBB/download/file.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index f781480bb7..abc67ecdac 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -718,7 +718,15 @@ function file_gc() */ function phpbb_is_greater_ie7($user_agent) { - return (bool) preg_match('/msie [^67]+\\.*;/', strtolower($user_agent)); + if (preg_match('/msie (\d+)/', strtolower($user_agent), $matches)) + { + $ie_version = (int) $matches[1]; + return ($ie_version > 7); + } + else + { + return false; + } } ?> \ No newline at end of file From 11cd9f901e53c2e1fe2aa1f3ce5d1f0c445d7ba7 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 5 Jun 2013 00:14:46 +0530 Subject: [PATCH 12/14] [ticket/10820] Inject IE version in function PHPBB3-10820 --- phpBB/download/file.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index abc67ecdac..009fa3572a 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -285,7 +285,7 @@ else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHME $db->sql_query($sql); } -if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && !phpbb_is_greater_ie7($user->browser)) +if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && !phpbb_is_greater_ie_version($user->browser, 7)) { wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']); file_gc(); @@ -344,7 +344,7 @@ function send_avatar_to_browser($file, $browser) $image_data = @getimagesize($file_path); header('Content-Type: ' . image_type_to_mime_type($image_data[2])); - if (!phpbb_is_greater_ie7($browser)) + if (!phpbb_is_greater_ie_version($browser, 7)) { header('Content-Disposition: attachment; ' . header_filename($file)); @@ -479,7 +479,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. header('Content-Type: ' . $attachment['mimetype']); - if (phpbb_is_greater_ie7($user->browser)) + if (phpbb_is_greater_ie_version($user->browser, 7)) { header('X-Content-Type-Options: nosniff'); } @@ -491,7 +491,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) } else { - if (empty($user->browser) || !phpbb_is_greater_ie7($user->browser)) + if (empty($user->browser) || !phpbb_is_greater_ie_version($user->browser, 7)) { header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) @@ -502,7 +502,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) else { header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); - if (phpbb_is_greater_ie7($user->browser) && (strpos($attachment['mimetype'], 'image') !== 0)) + if (phpbb_is_greater_ie_version($user->browser, 7) && (strpos($attachment['mimetype'], 'image') !== 0)) { header('X-Download-Options: noopen'); } @@ -680,7 +680,7 @@ function set_modified_headers($stamp, $browser) // let's see if we have to send the file at all $last_load = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime(trim($_SERVER['HTTP_IF_MODIFIED_SINCE'])) : false; - if (strpos(strtolower($browser), 'msie 6.0') === false && !phpbb_is_greater_ie7($browser)) + if (strpos(strtolower($browser), 'msie 6.0') === false && !phpbb_is_greater_ie_version($browser, 7)) { if ($last_load !== false && $last_load >= $stamp) { @@ -713,15 +713,16 @@ function file_gc() * Check if the browser is internet explorer version 7+ * * @param string $user_agent User agent HTTP header +* @param int $version IE version to check against * * @return bool true if internet explorer version is greater than 7 */ -function phpbb_is_greater_ie7($user_agent) +function phpbb_is_greater_ie_version($user_agent, $version) { if (preg_match('/msie (\d+)/', strtolower($user_agent), $matches)) { $ie_version = (int) $matches[1]; - return ($ie_version > 7); + return ($ie_version > $version); } else { From e0b9cdf708cf75ac189b935dad3e816a1363de3a Mon Sep 17 00:00:00 2001 From: Dhruv Date: Sat, 8 Jun 2013 23:13:45 +0530 Subject: [PATCH 13/14] [ticket/10820] Fix function docblock PHPBB3-10820 --- phpBB/download/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 009fa3572a..e06fd117cf 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -715,7 +715,7 @@ function file_gc() * @param string $user_agent User agent HTTP header * @param int $version IE version to check against * -* @return bool true if internet explorer version is greater than 7 +* @return bool true if internet explorer version is greater than $version */ function phpbb_is_greater_ie_version($user_agent, $version) { From 48f764437f3398696ad21177da02e024cc5804e5 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 13 Jun 2013 21:47:37 +0530 Subject: [PATCH 14/14] [ticket/10820] Add additional check for IE in condition PHPBB3-10820 --- phpBB/download/file.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index e06fd117cf..318e893fab 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -285,7 +285,7 @@ else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHME $db->sql_query($sql); } -if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && !phpbb_is_greater_ie_version($user->browser, 7)) +if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && (strpos(strtolower($browser), 'msie') !== false) && !phpbb_is_greater_ie_version($user->browser, 7)) { wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']); file_gc(); @@ -344,7 +344,7 @@ function send_avatar_to_browser($file, $browser) $image_data = @getimagesize($file_path); header('Content-Type: ' . image_type_to_mime_type($image_data[2])); - if (!phpbb_is_greater_ie_version($browser, 7)) + if ((strpos(strtolower($browser), 'msie') !== false) && !phpbb_is_greater_ie_version($browser, 7)) { header('Content-Disposition: attachment; ' . header_filename($file));