Browse Source

Check for Empty User Agent before Comparing

Andy 2 years ago
parent
commit
c85b5da58f
1 changed files with 11 additions and 9 deletions
  1. 11 9
      functions/template/general_util.php

+ 11 - 9
functions/template/general_util.php

@@ -35,15 +35,17 @@ function create_css_link($uri, $name='', $alt=TRUE, $mtype='screen') {
 
 
     sqGetGlobalVar('HTTP_USER_AGENT', $browser_user_agent, SQ_SERVER);
     sqGetGlobalVar('HTTP_USER_AGENT', $browser_user_agent, SQ_SERVER);
 
 
-    if (stristr($browser_user_agent, "msie 4")) {
-        $browser = 'msie4';
-        $dom_browser = false;
-        $is_IE = true;
-    } elseif (stristr($browser_user_agent, "msie") 
-           && stristr($browser_user_agent, 'opera') === FALSE) {
-        $browser = 'msie';
-        $dom_browser = true;
-        $is_IE = true;
+    if (!empty($browser_user_agent)) {
+        if (stristr($browser_user_agent, "msie 4")) {
+            $browser = 'msie4';
+            $dom_browser = false;
+            $is_IE = true;
+        } elseif (stristr($browser_user_agent, "msie") 
+               && stristr($browser_user_agent, 'opera') === FALSE) {
+            $browser = 'msie';
+            $dom_browser = true;
+            $is_IE = true;
+        }
     }
     }
 
 
     if ((strpos($uri, '-ie')!== false) and !$is_IE) {
     if ((strpos($uri, '-ie')!== false) and !$is_IE) {