Viewing file: browser.inc.php (4.11 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
############################################################################
# DWmail
# - version 4.0.4
# - Copyright (c) 2003-2006 Dominion Web Design
# - http://www.dominion-web.com/products/dwmail/
############################################################################
#
# The contents of this file are subject to the DWmail License version
# 2.2 ('License'). You may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.dominion-web.com/products/dwmail/license.php
# Software distributed under the License is distributed on an "AS IS" basis,
# without warranty of any kind, either express or implied.
#
# This code is Copyright (c) 2003-2006 Dominion Web Design.
# All rights reserved.
#
# This software may not be redistributed outside the terms of the
# license agreement.
#
############################################################################
# Browser detection routine for WYSIWYG Editor
# Supported browsers:
# - Internet Explorer 5.5+ on Windows
# - Mozilla 1.3+
# - Mozilla Firebird 0.6.1+
# - Mozilla Firefox 0.8+
# - Opera 9.0+
*/
$allowbrowser = 0;
function GetBrowserAgent(){
if (eregi("opera",$_SERVER['HTTP_USER_AGENT']) && !eregi("rv:[0-9]\.[0-9]\.[0-9]",$_SERVER['HTTP_USER_AGENT'])) {
$val = explode(" ",stristr($_SERVER['HTTP_USER_AGENT'],"opera"));
$val = explode("/",$val[0]);
$bd['browser'] = "Opera";
$bd['version'] = $val[1];
}
elseif (eregi("safari",$_SERVER['HTTP_USER_AGENT']) && !eregi("rv:[0-9]\.[0-9]\.[0-9]",$_SERVER['HTTP_USER_AGENT'])) {
$val = explode(" ",stristr($_SERVER['HTTP_USER_AGENT'],"safari"));
$val = explode("/",$val[0]);
$bd['browser'] = "Safari";
$bd['version'] = $val[1];
}
elseif (eregi("msie",$_SERVER['HTTP_USER_AGENT']) && !eregi("opera",$_SERVER['HTTP_USER_AGENT'])) {
$val = explode(" ",stristr($_SERVER['HTTP_USER_AGENT'],"msie"));
$bd['browser'] = $val[0];
$bd['version'] = $val[1];
}
elseif (eregi("galeon",$_SERVER['HTTP_USER_AGENT'])) {
$val = explode(" ",stristr($_SERVER['HTTP_USER_AGENT'],"galeon"));
$val = explode("/",$val[0]);
$bd['browser'] = $val[0];
$bd['version'] = $val[1];
}
elseif (eregi("Konqueror",$_SERVER['HTTP_USER_AGENT'])) {
$val = explode(" ",stristr($_SERVER['HTTP_USER_AGENT'],"Konqueror"));
$val = explode("/",$val[0]);
$bd['browser'] = $val[0];
$bd['version'] = $val[1];
}
elseif (eregi("icab",$_SERVER['HTTP_USER_AGENT'])) {
$val = explode(" ",stristr($_SERVER['HTTP_USER_AGENT'],"icab"));
$bd['browser'] = $val[0];
$bd['version'] = $val[1];
}
elseif (eregi("mozilla",$_SERVER['HTTP_USER_AGENT']) && !eregi("netscape",$_SERVER['HTTP_USER_AGENT'])) {
$bd['browser'] = "Mozilla";
eregi("rv:[a-z0-9]\.[a-z0-9]",$_SERVER['HTTP_USER_AGENT'],$val);
$bd['version'] = str_replace("rv:","",$val[0]);
}
elseif (eregi("netscape",$_SERVER['HTTP_USER_AGENT'])) {
$val = explode(" ",stristr($_SERVER['HTTP_USER_AGENT'],"netscape"));
$val = explode("/",$val[0]);
$bd['browser'] = $val[0];
$bd['version'] = $val[1];
}
elseif (eregi("mozilla",$_SERVER['HTTP_USER_AGENT']) && !eregi("rv:[0-9]\.[0-9]\.[0-9]",$_SERVER['HTTP_USER_AGENT'])) {
$val = explode(" ",stristr($_SERVER['HTTP_USER_AGENT'],"mozilla"));
$val = explode("/",$val[0]);
$bd['browser'] = "Netscape";
$bd['version'] = $val[1];
}
$bd['version'] = str_replace(";","",$bd['version']);
return ($bd);
}
$bd = GetBrowserAgent();
if (($bd['browser'] == "MSIE") && ($bd['version'] >= 6.0)) {
$allowbrowser = 1;
}
elseif (($bd['browser'] == "MSIE") && ($bd['version'] == 5.5)) {
$allowbrowser = 1;
}
elseif ($bd['browser'] == "Mozilla" && $bd['version'] >= 1.5) {
if (strstr($_SERVER['HTTP_USER_AGENT'], "Firebird") || strstr($_SERVER['HTTP_USER_AGENT'], "Firefox")) {
$allowbrowser = 1;
}
}
elseif ($bd['browser'] == "Mozilla" && $bd['version'] >= 1.3) {
if (!strstr($_SERVER['HTTP_USER_AGENT'], "Firebird") && !strstr($_SERVER['HTTP_USER_AGENT'], "Firefox")) {
$allowbrowser = 1;
}
}
elseif ($bd['browser'] == "Opera" && $bd['version'] >= 9.0) {
$allowbrowser = 1;
}
?>
|