Browse Source

Added detection for IE11 for FCKEditor - refs #7055

Yannick Warnier 11 years ago
parent
commit
8030b72526

+ 10 - 13
main/inc/lib/fckeditor/fckeditor.php

@@ -50,13 +50,10 @@ function FCKeditor_IsCompatibleBrowser()
         }
     }
 
-    if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
-    {
+    if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false ) {
         $iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
         return ($iVersion >= 5.5) ;
-    }
-    else if ( strpos($sAgent, 'Gecko/') !== false )
-    {
+    } else if ( strpos($sAgent, 'Gecko/') !== false ) {
         $iVersion = substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
         // Special fix for Firefox 17 and followers - see #5752
         if ( preg_match('/^\d{2,3}\.\d{1,4}\s/', $iVersion) ) {
@@ -65,19 +62,19 @@ function FCKeditor_IsCompatibleBrowser()
         $iVersion = (int)$iVersion;
         //return ($iVersion >= 20030210) ;
         return true;
-    }
-    else if ( strpos($sAgent, 'Opera/') !== false )
-    {
+    } else if ( strpos($sAgent, 'Gecko') !== false ) {
+        // Internet Explorer 11 - goes with a X-UA-Compatible IE=EmulateIE9 header
+        $iVersion = (int)substr($sAgent, strpos($sAgent, 'rv:') + 3, 2) ;
+        return ($iVersion >= 11);
+    } else if ( strpos($sAgent, 'Opera/') !== false ) {
         $fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ;
         return ($fVersion >= 9.5) ;
-    }
-    else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) )
-    {
+    } else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) ) {
         $iVersion = $matches[1] ;
         return ( $matches[1] >= 522 ) ;
-    }
-    else
+    } else {
         return false ;
+    }
 }
 
 class FCKeditor

+ 0 - 1
main/inc/lib/main_api.lib.php

@@ -5838,7 +5838,6 @@ function api_get_template($path_type = 'rel') {
 function api_browser_support($format="") {
     require_once api_get_path(LIBRARY_PATH).'browser/Browser.php';
     $browser = new Browser();
-    //print_r($browser);
     $current_browser = $browser->getBrowser();
     $a_versiontemp = explode('.', $browser->getVersion());
     $current_majorver= $a_versiontemp[0];

+ 6 - 0
main/inc/lib/template.lib.php

@@ -640,6 +640,12 @@ class Template
         $this->set_js_files();
         //$this->set_js_files_post();
 
+        $browser = api_browser_support('check_browser'); 
+        if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') {
+            $browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />';
+            $this->assign('browser_specific_head', $browser_head);
+        }
+
         // Implementation of prefetch.
         // See http://cdn.chamilo.org/main/img/online.png for details
         $prefetch = '';

+ 1 - 0
main/template/default/layout/head.tpl

@@ -4,6 +4,7 @@
 <link href="http://www.chamilo.org" rel="copyright" />
 {{ prefetch }}
 {{ favico }}
+{{ browser_specific_head }}
 <link rel="apple-touch-icon" href="{{ _p.web }}apple-touch-icon.png" />
 <meta name="apple-mobile-web-app-capable" content="yes" />
 <meta name="Generator" content="{{ _s.software_name }} {{ _s.system_version|slice(0,1) }}" />