[ Index ] |
|
Code source de FCKeditor 2.4 |
1 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 2 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 3 * 4 * == BEGIN LICENSE == 5 * 6 * Licensed under the terms of any of the following licenses at your 7 * choice: 8 * 9 * - GNU General Public License Version 2 or later (the "GPL") 10 * http://www.gnu.org/licenses/gpl.html 11 * 12 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 13 * http://www.gnu.org/licenses/lgpl.html 14 * 15 * - Mozilla Public License Version 1.1 or later (the "MPL") 16 * http://www.mozilla.org/MPL/MPL-1.1.html 17 * 18 * == END LICENSE == 19 * 20 * File Name: fxk.afp.code 21 * This is the class definition file for the sample pages. 22 * 23 * Version: 1.01 24 * Modified: 2006-11-13 25 * 26 * File Authors: Soenke Freitag (contact at www.afp-hosting.de) 27 * 28 29 DEFINE CLASS fckeditor AS custom 30 cInstanceName ="" 31 BasePath ="" 32 cWIDTH ="" 33 cHEIGHT ="" 34 ToolbarSet ="" 35 cValue="" 36 DIMENSION aConfig(10,2) 37 38 && ----------------------------------------------------------------------- 39 FUNCTION fckeditor( tcInstanceName ) 40 LOCAL lnLoop,lnLoop2 41 THIS.cInstanceName = tcInstanceName 42 THIS.BasePath = '../../../FCKeditor/' 43 THIS.cWIDTH = '100%' 44 THIS.cHEIGHT = '200' 45 THIS.ToolbarSet = 'Default' 46 THIS.cValue = '' 47 FOR lnLoop=1 TO 10 48 FOR lnLoop2=1 TO 2 49 THIS.aConfig(lnLoop,lnLoop2) = "" 50 NEXT 51 NEXT 52 RETURN 53 ENDFUNC 54 55 56 && ----------------------------------------------------------------------- 57 FUNCTION CREATE() 58 RETURN(THIS.CreateHtml()) 59 ENDFUNC 60 61 && ----------------------------------------------------------------------- 62 FUNCTION CreateHtml() 63 LOCAL html 64 LOCAL lcLink 65 66 HtmlValue = THIS.cValue && HTMLSPECIALCHARS() 67 68 html = [<div>] 69 IF THIS.IsCompatible() 70 lcLink = THIS.BasePath+[editor/fckeditor.html?InstanceName=]+THIS.cInstanceName 71 72 IF ( !THIS.ToolbarSet == '' ) 73 lcLink = lcLink + [&Toolbar=]+THIS.ToolbarSet 74 ENDIF 75 76 && Render the LINKED HIDDEN FIELD. 77 html = html + [<input type="hidden" id="]+THIS.cInstanceName +[" name="]+THIS.cInstanceName +[" value="]+HtmlValue+[">] 78 79 && Render the configurations HIDDEN FIELD. 80 html = html + [<input type="hidden" id="]+THIS.cInstanceName +[___Config" value="]+THIS.GetConfigFieldString() + [">] +CHR(13)+CHR(10) 81 82 && Render the EDITOR IFRAME. 83 html = html + [<iframe id="]+THIS.cInstanceName +[___Frame" src="]+lcLink+[" width="]+THIS.cWIDTH+[" height="]+THIS.cHEIGHT+[" frameborder="no" scrolling="no"></iframe>] 84 ELSE 85 IF ( AT("%", THIS.cWIDTH)=0 ) 86 WidthCSS = THIS.cWIDTH + 'px' 87 ELSE 88 WidthCSS = THIS.cWIDTH 89 ENDIF 90 91 IF ( AT("%",THIS.cHEIGHT)=0 ) 92 HeightCSS = THIS.cHEIGHT + 'px' 93 ELSE 94 HeightCSS = THIS.cHEIGHT 95 ENDIF 96 97 html = html + [<textarea name="]+THIS.cInstanceName +[" rows="4" cols="40" style="width: ]+WidthCSS+[ height: ]+HeightCSS+[" wrap="virtual">]+HtmlValue+[</textarea>] 98 ENDIF 99 100 html = html + [</div>] 101 102 RETURN (html) 103 ENDFUNC 104 105 106 && ----------------------------------------------------------------------- 107 FUNCTION IsCompatible() 108 LOCAL llRetval 109 LOCAL sAgent 110 111 llRetval=.F. 112 113 sAgent= LOWER(Request.ServerVariables("HTTP_USER_AGENT")) 114 115 IF AT("msie",sAgent) >0 .AND. AT("mac",sAgent)=0 .AND. AT("opera",sAgent)=0 116 iVersion=VAL(SUBSTR(sAgent,AT("msie",sAgent)+5,3)) 117 llRetval= iVersion > 5.5 118 ELSE 119 IF AT("gecko",sAgent)>0 120 iVersion=VAL(SUBSTR(sAgent,AT("gecko/",sAgent)+6,8)) 121 llRetval =iVersion > 20030210 122 ENDIF 123 ENDIF 124 RETURN (llRetval) 125 ENDFUNC 126 127 && ----------------------------------------------------------------------- 128 FUNCTION GetConfigFieldString() 129 LOCAL sParams 130 LOCAL bFirst 131 LOCAL sKey 132 sParams = "" 133 bFirst = .T. 134 FOR lnLoop=1 TO 10 && ALEN(this.aconfig) 135 IF !EMPTY(THIS.aConfig(lnLoop,1)) 136 IF bFirst = .F. 137 sParams = sParams + "&" 138 ELSE 139 bFirst = .F. 140 ENDIF 141 sParams = sParams +THIS.aConfig(lnLoop,1)+[=]+THIS.aConfig(lnLoop,2) 142 ELSE 143 EXIT 144 ENDIF 145 NEXT 146 RETURN(sParams) 147 ENDFUNC 148 && ----------------------------------------------------------------------- 149 && This function removes unwanted characters in URL parameters mostly entered by hackers 150 151 FUNCTION StripAttacks 152 LPARAMETERS tcString 153 IF !EMPTY(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,"%>","") 160 tcString=STRTRAN(tcString,"<","") 161 tcString=STRTRAN(tcString,">","") 162 tcString=STRTRAN(tcString,"..","") 163 tcString=STRTRAN(tcString,"/","") 164 tcString=STRTRAN(tcString,"\","") 165 tcString=STRTRAN(tcString,":","") 166 ELSE 167 tcString="" 168 ENDIF 169 RETURN (tcString) 170 171 ENDDEFINE 172
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:28:05 2007 | par Balluche grâce à PHPXref 0.7 |