1
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
2
* Copyright (C) 2003-2008 Frederico Caldeira Knabben
6
* Licensed under the terms of any of the following licenses at your
9
* - GNU General Public License Version 2 or later (the "GPL")
10
* http://www.gnu.org/licenses/gpl.html
12
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
13
* http://www.gnu.org/licenses/lgpl.html
15
* - Mozilla Public License Version 1.1 or later (the "MPL")
16
* http://www.mozilla.org/MPL/MPL-1.1.html
20
* This is the class definition file for the sample pages.
23
DEFINE CLASS fckeditor AS custom
30
DIMENSION aConfig(10,2)
32
&& -----------------------------------------------------------------------
33
FUNCTION fckeditor( tcInstanceName )
35
THIS.cInstanceName = tcInstanceName
36
THIS.BasePath = '../../../FCKeditor/'
39
THIS.ToolbarSet = 'Default'
43
THIS.aConfig(lnLoop,lnLoop2) = ""
50
&& -----------------------------------------------------------------------
52
RETURN(THIS.CreateHtml())
55
&& -----------------------------------------------------------------------
60
HtmlValue = THIS.cValue && HTMLSPECIALCHARS()
63
IF THIS.IsCompatible()
64
lcLink = THIS.BasePath+[editor/fckeditor.html?InstanceName=]+THIS.cInstanceName
66
IF ( !THIS.ToolbarSet == '' )
67
lcLink = lcLink + [&Toolbar=]+THIS.ToolbarSet
70
&& Render the LINKED HIDDEN FIELD.
71
html = html + [<input type="hidden" id="]+THIS.cInstanceName +[" name="]+THIS.cInstanceName +[" value="]+HtmlValue+[">]
73
&& Render the configurations HIDDEN FIELD.
74
html = html + [<input type="hidden" id="]+THIS.cInstanceName +[___Config" value="]+THIS.GetConfigFieldString() + [">] +CHR(13)+CHR(10)
76
&& Render the EDITOR IFRAME.
77
html = html + [<iframe id="]+THIS.cInstanceName +[___Frame" src="]+lcLink+[" width="]+THIS.cWIDTH+[" height="]+THIS.cHEIGHT+[" frameborder="no" scrolling="no"></iframe>]
79
IF ( AT("%", THIS.cWIDTH)=0 )
80
WidthCSS = THIS.cWIDTH + 'px'
82
WidthCSS = THIS.cWIDTH
85
IF ( AT("%",THIS.cHEIGHT)=0 )
86
HeightCSS = THIS.cHEIGHT + 'px'
88
HeightCSS = THIS.cHEIGHT
91
html = html + [<textarea name="]+THIS.cInstanceName +[" rows="4" cols="40" style="width: ]+WidthCSS+[ height: ]+HeightCSS+[" wrap="virtual">]+HtmlValue+[</textarea>]
94
html = html + [</div>]
100
&& -----------------------------------------------------------------------
101
FUNCTION IsCompatible()
107
sAgent= LOWER(Request.ServerVariables("HTTP_USER_AGENT"))
109
IF AT("msie",sAgent) >0 .AND. AT("mac",sAgent)=0 .AND. AT("opera",sAgent)=0
110
iVersion=VAL(SUBSTR(sAgent,AT("msie",sAgent)+5,3))
111
llRetval= iVersion > 5.5
113
IF AT("gecko",sAgent)>0
114
iVersion=VAL(SUBSTR(sAgent,AT("gecko/",sAgent)+6,8))
115
llRetval =iVersion > 20030210
121
&& -----------------------------------------------------------------------
122
FUNCTION GetConfigFieldString()
128
FOR lnLoop=1 TO 10 && ALEN(this.aconfig)
129
IF !EMPTY(THIS.aConfig(lnLoop,1))
131
sParams = sParams + "&"
135
sParams = sParams +THIS.aConfig(lnLoop,1)+[=]+THIS.aConfig(lnLoop,2)
142
&& -----------------------------------------------------------------------
143
&& This function removes unwanted characters in URL parameters mostly entered by hackers
145
FUNCTION StripAttacks
148
tcString=STRTRAN(tcString,"&","")
149
tcString=STRTRAN(tcString,"?","")
150
tcString=STRTRAN(tcString,";","")
151
tcString=STRTRAN(tcString,"!","")
152
tcString=STRTRAN(tcString,"<%","")
153
tcString=STRTRAN(tcString,"%>","")
154
tcString=STRTRAN(tcString,"<","")
155
tcString=STRTRAN(tcString,">","")
156
tcString=STRTRAN(tcString,"..","")
157
tcString=STRTRAN(tcString,"/","")
158
tcString=STRTRAN(tcString,"\","")
159
tcString=STRTRAN(tcString,":","")