2
# FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
# Copyright (C) 2003-2010 Frederico Caldeira Knabben
7
# Licensed under the terms of any of the following licenses at your
10
# - GNU General Public License Version 2 or later (the "GPL")
11
# http://www.gnu.org/licenses/gpl.html
13
# - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
# http://www.gnu.org/licenses/lgpl.html
16
# - Mozilla Public License Version 1.1 or later (the "MPL")
17
# http://www.mozilla.org/MPL/MPL-1.1.html
21
# This is the integration file for Perl.
35
local($instanceName) = @_;
36
$InstanceName = $instanceName;
37
$BasePath = '/fckeditor/';
40
$ToolbarSet = 'Default';
54
$ch =~ s/&/&/g; # &
55
$ch =~ s/\"/"/g; #"
56
$ch =~ s/\'/'/g; # '
57
$ch =~ s/</</g; # <
58
$ch =~ s/>/>/g; # >
65
$HtmlValue = &specialchar_cnv($Value);
68
$Link = $BasePath . "editor/fckeditor.html?InstanceName=$InstanceName";
69
if($ToolbarSet ne '') {
70
$Link .= "&Toolbar=$ToolbarSet";
72
#// Render the linked hidden field.
73
$Html .= "<input type=\"hidden\" id=\"$InstanceName\" name=\"$InstanceName\" value=\"$HtmlValue\" style=\"display:none\" />" ;
75
#// Render the configurations hidden field.
76
$cfgstr = &GetConfigFieldString();
77
$wk = $InstanceName."___Config";
78
$Html .= "<input type=\"hidden\" id=\"$wk\" value=\"$cfgstr\" style=\"display:none\" />" ;
80
#// Render the editor IFRAME.
81
$wk = $InstanceName."___Frame";
82
$Html .= "<iframe id=\"$wk\" src=\"$Link\" width=\"$Width\" height=\"$Height\" frameborder=\"0\" scrolling=\"no\"></iframe>";
87
$WidthCSS = $Width . 'px';
92
$HeightCSS = $Height . 'px';
94
$Html .= "<textarea name=\"$InstanceName\" rows=\"4\" cols=\"40\" style=\"width: $WidthCSS; height: $HeightCSS\">$HtmlValue</textarea>";
102
$sAgent = $ENV{'HTTP_USER_AGENT'};
103
if(($sAgent =~ /MSIE/i) && !($sAgent =~ /mac/i) && !($sAgent =~ /Opera/i)) {
104
$iVersion = substr($sAgent,index($sAgent,'MSIE') + 5,3);
105
return($iVersion >= 5.5) ;
106
} elsif($sAgent =~ /Gecko\//i) {
107
$iVersion = substr($sAgent,index($sAgent,'Gecko/') + 6,8);
108
return($iVersion >= 20030210) ;
109
} elsif($sAgent =~ /Opera\//i) {
110
$iVersion = substr($sAgent,index($sAgent,'Opera/') + 6,4);
111
return($iVersion >= 9.5) ;
112
} elsif($sAgent =~ /AppleWebKit\/(\d+)/i) {
115
return(0); # 2.0 PR fix
119
sub GetConfigFieldString
123
foreach $sKey (keys %Config) {
124
$sValue = $Config{$sKey};
130
$k = &specialchar_cnv($sKey);
131
$v = &specialchar_cnv($sValue);
132
if($sValue eq "true") {
133
$sParams .= "$k=true";
134
} elsif($sValue eq "false") {
135
$sParams .= "$k=false";