PageRenderTime 16ms CodeModel.GetById 9ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/source/Plug-in/fck/fckeditor.php

http://prosporous.googlecode.com/
PHP | 71 lines | 40 code | 6 blank | 25 comment | 13 complexity | 0f93867a3ed9072a8fca90e642a718a5 MD5 | raw file
 1<?php
 2/*
 3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 4 * Copyright (C) 2003-2007 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
28function FCKeditor_IsCompatibleBrowser()
29{
30	global $HTTP_USER_AGENT ;
31
32	if ( !isset( $_SERVER ) ) {
33		global $HTTP_SERVER_VARS ;
34	    $_SERVER = $HTTP_SERVER_VARS ;
35	}
36		
37	if ( isset( $HTTP_USER_AGENT ) )
38		$sAgent = $HTTP_USER_AGENT ;
39	else
40		$sAgent = $_SERVER['HTTP_USER_AGENT'] ;
41
42	if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
43	{
44		$iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
45		return ($iVersion >= 5.5) ;
46	}
47	else if ( strpos($sAgent, 'Gecko/') !== false )
48	{
49		$iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
50		return ($iVersion >= 20030210) ;
51	}
52	else if ( strpos($sAgent, 'Opera/') !== false )
53	{
54		$fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ;
55		return ($fVersion >= 9.5) ;
56	}
57	else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) )
58	{
59		$iVersion = $matches[1] ;
60		return ( $matches[1] >= 522 ) ;
61	}
62	else
63		return false ;	
64}
65
66if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) )
67	include_once( 'fckeditor_php4.php' ) ;
68else
69	include_once( 'fckeditor_php5.php' ) ;
70
71?>