Ticket #2206: 2206.2.patch

File 2206.2.patch, 4.5 KB (added by Wiktor Walc, 16 years ago)
  • fckeditor.php

     
    2525 * strict error messages with PHP 5).
    2626 */
    2727
    28 /**
    29  * Check if browser is compatible with FCKeditor.
    30  * Return true if is compatible.
    31  *
    32  * @return boolean
    33  */
    34 function FCKeditor_IsCompatibleBrowser()
    35 {
    36         if ( isset( $_SERVER ) ) {
    37                 $sAgent = $_SERVER['HTTP_USER_AGENT'] ;
    38         }
    39         else {
    40                 global $HTTP_SERVER_VARS ;
    41                 if ( isset( $HTTP_SERVER_VARS ) ) {
    42                         $sAgent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ;
    43                 }
    44                 else {
    45                         global $HTTP_USER_AGENT ;
    46                         $sAgent = $HTTP_USER_AGENT ;
    47                 }
    48         }
    49 
    50         if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
    51         {
    52                 $iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
    53                 return ($iVersion >= 5.5) ;
    54         }
    55         else if ( strpos($sAgent, 'Gecko/') !== false )
    56         {
    57                 $iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
    58                 return ($iVersion >= 20030210) ;
    59         }
    60         else if ( strpos($sAgent, 'Opera/') !== false )
    61         {
    62                 $fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ;
    63                 return ($fVersion >= 9.5) ;
    64         }
    65         else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) )
    66         {
    67                 $iVersion = $matches[1] ;
    68                 return ( $matches[1] >= 522 ) ;
    69         }
    70         else
    71                 return false ;
    72 }
    73 
    7428if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) )
    7529        include_once( 'fckeditor_php4.php' ) ;
    7630else
  • fckeditor_php4.php

     
    2525 * instances in PHP pages on server side.
    2626 */
    2727
     28/**
     29 * Check if browser is compatible with FCKeditor.
     30 * Return true if is compatible.
     31 *
     32 * @return boolean
     33 */
     34function FCKeditor_IsCompatibleBrowser()
     35{
     36        if ( isset( $_SERVER ) ) {
     37                $sAgent = $_SERVER['HTTP_USER_AGENT'] ;
     38        }
     39        else {
     40                global $HTTP_SERVER_VARS ;
     41                if ( isset( $HTTP_SERVER_VARS ) ) {
     42                        $sAgent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ;
     43                }
     44                else {
     45                        global $HTTP_USER_AGENT ;
     46                        $sAgent = $HTTP_USER_AGENT ;
     47                }
     48        }
     49
     50        if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
     51        {
     52                $iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
     53                return ($iVersion >= 5.5) ;
     54        }
     55        else if ( strpos($sAgent, 'Gecko/') !== false )
     56        {
     57                $iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
     58                return ($iVersion >= 20030210) ;
     59        }
     60        else if ( strpos($sAgent, 'Opera/') !== false )
     61        {
     62                $fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ;
     63                return ($fVersion >= 9.5) ;
     64        }
     65        else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) )
     66        {
     67                $iVersion = $matches[1] ;
     68                return ( $matches[1] >= 522 ) ;
     69        }
     70        else
     71                return false ;
     72}
     73
    2874class FCKeditor
    2975{
    3076        /**
  • fckeditor_php5.php

     
    2525 * instances in PHP pages on server side.
    2626 */
    2727
     28/**
     29 * Check if browser is compatible with FCKeditor.
     30 * Return true if is compatible.
     31 *
     32 * @return boolean
     33 */
     34function FCKeditor_IsCompatibleBrowser()
     35{
     36        if ( isset( $_SERVER ) ) {
     37                $sAgent = $_SERVER['HTTP_USER_AGENT'] ;
     38        }
     39        else {
     40                global $HTTP_SERVER_VARS ;
     41                if ( isset( $HTTP_SERVER_VARS ) ) {
     42                        $sAgent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ;
     43                }
     44                else {
     45                        global $HTTP_USER_AGENT ;
     46                        $sAgent = $HTTP_USER_AGENT ;
     47                }
     48        }
     49
     50        if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
     51        {
     52                $iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
     53                return ($iVersion >= 5.5) ;
     54        }
     55        else if ( strpos($sAgent, 'Gecko/') !== false )
     56        {
     57                $iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
     58                return ($iVersion >= 20030210) ;
     59        }
     60        else if ( strpos($sAgent, 'Opera/') !== false )
     61        {
     62                $fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ;
     63                return ($fVersion >= 9.5) ;
     64        }
     65        else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) )
     66        {
     67                $iVersion = $matches[1] ;
     68                return ( $matches[1] >= 522 ) ;
     69        }
     70        else
     71                return false ;
     72}
     73
    2874class FCKeditor
    2975{
    3076        /**
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy