Ticket #1744: FCKeditor.java.patch
File FCKeditor.java.patch, 1.9 KB (added by , 16 years ago) |
---|
-
.java
old new 246 246 if ((userAgent.indexOf("msie") !=-1) && (userAgent.indexOf("mac") == -1) && (userAgent.indexOf("opera") == -1)) { 247 247 if(retrieveBrowserVersion(userAgent)>=5.5) 248 248 return true; 249 } 249 } 250 250 else if (userAgent.indexOf("gecko") !=-1){ 251 if(retrieveBrowserVersion(userAgent)>= 20030210)251 if(retrieveBrowserVersion(userAgent)>=1.3) // >=1.3 according to fckeditor.net 252 252 return true; 253 253 } 254 254 return false; 255 255 } 256 256 257 private double retrieveBrowserVersion(String userAgent) { 257 private double retrieveBrowserVersion(String userAgent) { 258 258 if(userAgent.indexOf("msie")>-1) { 259 259 String str = userAgent.substring(userAgent.indexOf("msie") + 5); 260 260 return Double.parseDouble(str.substring(0, str.indexOf(";"))); 261 } 262 else { 263 String str = userAgent.substring(userAgent.indexOf("gecko") + 6); 264 return Double.parseDouble(str.substring(0, 8)); 265 } 261 } else { 262 /* The following case fails: 263 String str = userAgent.substring(userAgent.indexOf("gecko") + 6); 264 "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.2) Gecko/Debian-1.5.dfsg+1.5.0.2-3 Firefox/1.5.0.2 265 266 According to: 267 http://en.wikipedia.org/wiki/User_agent#Mozilla 268 269 Fix: 270 */ 271 String str = userAgent.split("(.+rv:)|((; .+)*\\).+)")[1].substring(0,3); 272 return Double.parseDouble(str); 273 /* Checked in: 274 * Firefox 1.5.0.2 / Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.0.2) Gecko/Debian-1.5.dfsg+1.5.0.2-3 Firefox/1.5.0.2 275 * Firefox 1.5.0.2 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2 276 * Mozilla 1.7.12 277 * Epiphany 1.8.3 278 279 Doesn't (obviously) work in: 280 * mozilla/5.0 (compatible; konqueror/3.5; linux) khtml/3.5.2 (like gecko) 281 */ 282 } 266 283 } 267 284 268 285 private String HTMLEncode(String txt) {