|
From: Henry S. <kel...@us...> - 2007-11-16 14:21:08
|
Update of /cvsroot/phpbb/phpBB2/download In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19915/download Modified Files: file.php Log Message: Nothing we can do about IE 6, but this should reduce the bandwidth need significantly. Index: file.php =================================================================== RCS file: /cvsroot/phpbb/phpBB2/download/file.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** file.php 14 Oct 2007 13:12:08 -0000 1.3 --- file.php 16 Nov 2007 14:21:05 -0000 1.4 *************** *** 33,36 **** --- 33,39 ---- } unset($dbpasswd); + + // worst-case default + $browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0'; $config = $cache->obtain_config(); *************** *** 54,60 **** exit; } ! $ext = substr(strrchr($filename, '.'), 1); ! $filename = intval($filename); if (!in_array($ext, array('png', 'gif', 'jpg', 'jpeg'))) --- 57,79 ---- exit; } ! $ext = substr(strrchr($filename, '.'), 1); ! $stamp = (int) substr(stristr($filename, '_'), 1); ! $filename = (int) $filename; ! ! // 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) ! { ! if ($last_load !== false && $last_load <= $stamp) ! { ! header('Not Modified', true, 304); ! exit(); ! } ! else ! { ! header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $stamp) . ' GMT'); ! } ! } if (!in_array($ext, array('png', 'gif', 'jpg', 'jpeg'))) *************** *** 69,73 **** exit; } ! if (!$filename) { --- 88,92 ---- exit; } ! if (!$filename) { *************** *** 82,86 **** } ! send_avatar_to_browser(($avatar_group ? 'g' : '') . $filename . '.' . $ext); if (!empty($cache)) --- 101,105 ---- } ! send_avatar_to_browser(($avatar_group ? 'g' : '') . $filename . '.' . $ext, $browser); if (!empty($cache)) *************** *** 268,272 **** * The argument needs to be checked before calling this function. */ ! function send_avatar_to_browser($file) { global $config, $phpbb_root_path; --- 287,291 ---- * The argument needs to be checked before calling this function. */ ! function send_avatar_to_browser($file, $browser) { global $config, $phpbb_root_path; *************** *** 275,281 **** $image_dir = $config['avatar_path']; - // worst-case default - $browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0'; - // Adjust image_dir path (no trailing slash) if (substr($image_dir, -1, 1) == '/' || substr($image_dir, -1, 1) == '\\') --- 294,297 ---- *************** *** 291,295 **** $file_path = $phpbb_root_path . $image_dir . '/' . $prefix . $file; ! if ((@file_exists($file_path) && @is_readable($file_path)) || headers_sent()) { header('Pragma: public'); --- 307,311 ---- $file_path = $phpbb_root_path . $image_dir . '/' . $prefix . $file; ! if ((@file_exists($file_path) && @is_readable($file_path)) && !headers_sent()) { header('Pragma: public'); |