2
# FCKeditor - The text editor for internet
3
# Copyright (C) 2003-2005 Frederico Caldeira Knabben
5
# Licensed under the terms of the GNU Lesser General Public License:
6
# http://www.opensource.org/licenses/lgpl-license.php
8
# For further information visit:
9
# http://www.fckeditor.net/
11
# "Support Open Source software. What about a donation today?"
13
# File Name: fckeditor.pl
14
# This is the integration file for Perl.
17
# Takashi Yamaguchi (jack@omakase.net)
31
local($instanceName) = @_;
32
$InstanceName = $instanceName;
33
$BasePath = '/FCKeditor/';
36
$ToolbarSet = 'Default';
50
$ch =~ s/&/&/g; # &
51
$ch =~ s/\"/"/g; #"
52
$ch =~ s/\'/'/g; # '
53
$ch =~ s/</</g; # <
54
$ch =~ s/>/>/g; # >
61
$HtmlValue = &specialchar_cnv($Value);
64
$Link = $BasePath . "editor/fckeditor.html?InstanceName=$InstanceName";
65
if($ToolbarSet ne '') {
66
$Link .= "&Toolbar=$ToolbarSet";
68
#// Render the linked hidden field.
69
$Html .= "<input type=\"hidden\" id=\"$InstanceName\" name=\"$InstanceName\" value=\"$HtmlValue\" style=\"display:none\" />" ;
71
#// Render the configurations hidden field.
72
$cfgstr = &GetConfigFieldString();
73
$wk = $InstanceName."___Config";
74
$Html .= "<input type=\"hidden\" id=\"$wk\" value=\"$cfgstr\" style=\"display:none\" />" ;
76
#// Render the editor IFRAME.
77
$wk = $InstanceName."___Frame";
78
$Html .= "<iframe id=\"$wk\" src=\"$Link\" width=\"$Width\" height=\"$Height\" frameborder=\"no\" scrolling=\"no\"></iframe>";
83
$WidthCSS = $Width . 'px';
88
$HeightCSS = $Height . 'px';
90
$Html .= "<textarea name=\"$InstanceName\" rows=\"4\" cols=\"40\" style=\"width: $WidthCSS; height: $HeightCSS\">$HtmlValue</textarea>";
99
$sAgent = $ENV{'HTTP_USER_AGENT'};
100
if(($sAgent =~ /MSIE/i) && !($sAgent =~ /mac/i) && !($sAgent =~ /Opera/i)) {
101
$iVersion = substr($sAgent,index($sAgent,'MSIE') + 5,3);
102
return($iVersion >= 5.5) ;
103
} elsif($sAgent =~ /Gecko\//i) {
104
$iVersion = substr($sAgent,index($sAgent,'Gecko/') + 6,8);
105
return($iVersion >= 20030210) ;
107
return(0); # 2.0 PR fix
111
sub GetConfigFieldString
115
foreach $sKey (keys %Config) {
116
$sValue = $Config{$sKey};
122
$k = &specialchar_cnv($sKey);
123
$v = &specialchar_cnv($sValue);
124
if($sValue eq "true") {
125
$sParams .= "$k=true";
126
} elsif($sValue eq "false") {
127
$sParams .= "$k=false";