summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas BrĂ¼derli2008-09-23 09:53:41 +0000
committerThomas BrĂ¼derli2008-09-23 09:53:41 +0000
commit4e20871f1a5d8ad690e742dabb6957763983a6c0 (patch)
tree1663b935937f428eb87f4ec4115d0430cdffc198
parent0044f5319e691d9fd279e6f49b4ac09f5dc60079 (diff)
downloaditools-4e20871f1a5d8ad690e742dabb6957763983a6c0.tar.gz
itools-4e20871f1a5d8ad690e742dabb6957763983a6c0.tar.bz2
itools-4e20871f1a5d8ad690e742dabb6957763983a6c0.zip
Improve browser detection
-rw-r--r--it_browser.class10
1 files changed, 8 insertions, 2 deletions
diff --git a/it_browser.class b/it_browser.class
index c20b6c3..f46df92 100644
--- a/it_browser.class
+++ b/it_browser.class
@@ -59,7 +59,7 @@ class it_browser
function it_browser()
{
$this->UserAgent = $_SERVER['HTTP_USER_AGENT'];
- /* $this->UserAgent = "Mozilla/4.0 [de] (compatible; MSIE 5.0; Bill Gates 1.0; Windows 95)"; */
+ /* $this->UserAgent = "Mozilla/4.0 [de] (compatible; MSIE 5.0; Windows 95; .NET CRL 2.0.154)"; */
/* Find "Mozilla/4.0" */
if (ereg("([^/]*)/([^ ]*)", $this->UserAgent, $regs))
@@ -82,7 +82,7 @@ function it_browser()
else
$this->Type = $optattr[1];
- $this->Platform = $optattr[count($optattr)-1];
+ $this->Platform = !empty($optattr[2]) ? $optattr[2] : $optattr[count($optattr)-1];
}
else
$this->Platform = $optattr[0];
@@ -115,6 +115,12 @@ function it_browser()
else if ($this->Type == "Mozilla" && $this->Version < 5)
$this->Type = "Netscape";
+ /* Read language from Accept-Language header */
+ if (!$this->Language && $_SERVER['HTTP_ACCEPT_LANGUAGE'])
+ {
+ $accept_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+ $this->Language = substr($accept_langs[0], 0, 2);
+ }
/* And now for the browser capabilities ... */
if ($this->Type == "MSIE")