fckeditor.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /*
  3. * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  4. * Copyright (C) 2003-2008 Frederico Caldeira Knabben
  5. *
  6. * == BEGIN LICENSE ==
  7. *
  8. * Licensed under the terms of any of the following licenses at your
  9. * choice:
  10. *
  11. * - GNU General Public License Version 2 or later (the "GPL")
  12. * http://www.gnu.org/licenses/gpl.html
  13. *
  14. * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  15. * http://www.gnu.org/licenses/lgpl.html
  16. *
  17. * - Mozilla Public License Version 1.1 or later (the "MPL")
  18. * http://www.mozilla.org/MPL/MPL-1.1.html
  19. *
  20. * == END LICENSE ==
  21. *
  22. * This is the integration file for PHP (All versions).
  23. *
  24. * It loads the correct integration file based on the PHP version (avoiding
  25. * strict error messages with PHP 5).
  26. */
  27. /**
  28. * Check if browser is compatible with FCKeditor.
  29. * Return true if is compatible.
  30. *
  31. * @return boolean
  32. */
  33. function FCKeditor_IsCompatibleBrowser()
  34. {
  35. if ( isset( $_SERVER ) ) {
  36. $sAgent = $_SERVER['HTTP_USER_AGENT'] ;
  37. }
  38. else {
  39. global $HTTP_SERVER_VARS ;
  40. if ( isset( $HTTP_SERVER_VARS ) ) {
  41. $sAgent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ;
  42. }
  43. else {
  44. global $HTTP_USER_AGENT ;
  45. $sAgent = $HTTP_USER_AGENT ;
  46. }
  47. }
  48. if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
  49. {
  50. $iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
  51. return ($iVersion >= 5.5) ;
  52. }
  53. else if ( strpos($sAgent, 'Gecko/') !== false )
  54. {
  55. $iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
  56. return ($iVersion >= 20030210) ;
  57. }
  58. else if ( strpos($sAgent, 'Opera/') !== false )
  59. {
  60. $fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ;
  61. return ($fVersion >= 9.5) ;
  62. }
  63. else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) )
  64. {
  65. $iVersion = $matches[1] ;
  66. return ( $matches[1] >= 522 ) ;
  67. }
  68. else
  69. return false ;
  70. }
  71. if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) )
  72. include_once( 'fckeditor_php4.php' ) ;
  73. else
  74. include_once( 'fckeditor_php5.php' ) ;