diff --git a/phpgwapi/inc/class.browser.inc.php b/phpgwapi/inc/class.browser.inc.php index 1c30fb6c1e..72fe53661a 100644 --- a/phpgwapi/inc/class.browser.inc.php +++ b/phpgwapi/inc/class.browser.inc.php @@ -39,14 +39,27 @@ */ if (ereg( 'MSIE ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) { - $this->BROWSER_VER=$log_version[1]; - $this->BROWSER_AGENT='IE'; + $this->BROWSER_VER = $log_version[1]; + $this->BROWSER_AGENT = 'IE'; } - elseif (ereg( 'Opera ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) + elseif (ereg( 'Opera ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version) || + ereg( 'Opera/([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) { - $this->BROWSER_VER=$log_version[1]; - $this->BROWSER_AGENT='OPERA'; + $this->BROWSER_VER = $log_version[1]; + $this->BROWSER_AGENT = 'OPERA'; } + elseif ( eregi( 'iCab ([0-9].[0-9a-zA-Z]{1,4})',$HTTP_USER_AGENT,$log_version) || + eregi( 'iCab/([0-9].[0-9a-zA-Z]{1,4})',$HTTP_USER_AGENT,$log_version)) + { + $this->BROWSER_VER = $log_version[1]; + $this->BROWSER_AGENT = 'iCab'; + } + elseif ( eregi( 'Netscape6/([0-9].[0-9a-zA-Z]{1,4})',$HTTP_USER_AGENT,$log_version)) + { + $this->BROWSER_VER = $log_version[1]; + $this->BROWSER_AGENT = 'Netscape'; + } + elseif (ereg( 'Mozilla/([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) { $this->BROWSER_VER=$log_version[1]; @@ -206,5 +219,25 @@ return false; } } + + // Echo content headers for file downloads + function content_header($fn="") + { + if ($fn) + { + if ($this->get_agent() == "IE") // && browser_get_version() == "5.5") + { + $attachment = ""; + } + else + { + $attachment = " attachment;"; + } + header('Content-disposition:'.$attachment.' filename="'.$fn.'"'); + header('Content-type: application/octetstream'); + header('Pragma: no-cache'); + header('Expires: 0'); + } + } } ?>