diff options
author | Dhruv <dhruv.goel92@gmail.com> | 2013-06-05 00:27:32 +0530 |
---|---|---|
committer | Dhruv <dhruv.goel92@gmail.com> | 2013-06-05 00:27:32 +0530 |
commit | e6d521df298884ecb86e6cb2d35ef5570688b078 (patch) | |
tree | be8ba5a6b5cd5e772563e18de153e097267d4937 /phpBB/includes | |
parent | d522dc5372cc8060245e5f81bcf759bf1bfc5c57 (diff) | |
parent | 56e27a9908b759b9ec1aadb6f58a2f0f1b4f3ab3 (diff) | |
download | forums-e6d521df298884ecb86e6cb2d35ef5570688b078.tar forums-e6d521df298884ecb86e6cb2d35ef5570688b078.tar.gz forums-e6d521df298884ecb86e6cb2d35ef5570688b078.tar.bz2 forums-e6d521df298884ecb86e6cb2d35ef5570688b078.tar.xz forums-e6d521df298884ecb86e6cb2d35ef5570688b078.zip |
Merge branch 'ticket/10820' into ticket/10820-develop
* ticket/10820:
[ticket/10820] Inject IE version in function
Conflicts:
phpBB/download/file.php
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_download.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 5947eecaac..8329ef6374 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -46,7 +46,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)); @@ -176,7 +176,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'); } @@ -188,7 +188,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)) @@ -199,7 +199,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'); } @@ -410,7 +410,7 @@ function set_modified_headers($stamp, $browser) // let's see if we have to send the file at all $last_load = $request->header('Modified-Since') ? strtotime(trim($request->header('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) { @@ -726,15 +726,16 @@ function phpbb_download_clean_filename($filename) * 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 { |