The basic steps for integrating FCKeditor v2.6 (the latest version) are as follows:
1. Download The FCKeditor 2.6 Basic file (main code ). Copy the decompressed file to the editors/fckeditorv2 directory of the project.
2. Download The FCKeditor. Net/ASP. NET control and copy the fredck. fckeditorv2.dll file to the bin directory of the project.
In this way, you can use the FCKeditor v2.6 powerful editor. Of course, you also need to set the default editor in host settings.
For some basic configuration information about FCKeditor, refer to the followingArticle:
to use the file upload function, modify Code fckeditorv2/Editor/filemanager/connectors/config. ascx (take the aspx code as an example ). Only logged-on users can use the file upload function, and only uploaded files can be uploaded to their own directories. Automatically create a file upload directory based on the user name.
connectors/config. the updated ascx code is as follows: copy Code the code is as follows: /**
* This function must check the user session to be sure that he/she is
* authorized to upload and access files in the file browser.
*/
private string m_username;
private int m_userid;
private int m_boardid;
private bool m_isauthenticated;
Private bool checkauthentication ()
{
// Warning: do not simply return "true". By doing so, you are allowing
// "Anyone" to upload and list the files in your server. You must implement
// Some kind of session validation here. Even something very simple...
//
// Return (session ["isauthorized"]! = NULL & (bool) session ["isauthorized"] = true );
//
//... Where session ["isauthorized"] is set to "true" as soon as
// User logs in your system.
String username = httpcontext. Current. User. Identity. Name;
Try
{
If (httpcontext. Current. User. Identity. isauthenticated)
{
String [] parts = username. Split (';');
If (parts. Length = 3)
{
M_userid = int. parse (parts [0]);
M_boardid = int. parse (parts [1]);
M_username = parts [2];
M_isauthenticated = true;
}
}
}
Catch (exception)
{
M_username = "";
M_userid = 0;
M_boardid = 0;
M_isauthenticated = false;
}
Return m_isauthenticated;
}
Public override void setconfig ()
{
// Security: You must explicitly enable this "connector". (set it to "true ").
Enabled = checkauthentication ();
// URL path to user files.
Userfilespath = "/userfiles /";
// The connector tries to resolve the above userfilespath automatically.
// Use the following setting it you prefer to explicitely specify
// Absolute path. Examples: 'C: \ mysite \ userfiles \ 'or'/root/mysite/userfiles /'.
// Attention: the above 'userfilespath' URL must point to the same directory.
Userfilesabsolutepath = "";
// Due to security issues with Apache modules, it is recommended to leave
// Following setting enabled.
Forcesingleextension = true;
// Allowed resource types
Allowedtypes = new string [] {"file", "image", "Flash", "Media "};
// For security, HTML is allowed in the first KB of data for files having
// Following extensions only.
Htmlextensions = new string [] {"html", "htm", "XML", "XSD", "TXT", "JS "};
typeconfig ["file"]. allowedextensions = new string [] {"7z", "AIFF", "ASF", "Avi", "BMP", "CSV", "Doc", "FLA ", "FLV", "GIF", "GZ", "gzip", "Jpeg", "jpg", "mid", "mov", "MP3", "MP4 ", "MPC", "MPEG", "MPG", "ODS", "ODT", "pdf", "PNG", "ppt", "pxd", "QT ", "Ram", "RAR", "RM", "RMI", "rmvb", "rtf", "SDC", "sitd", "SWF", "SXC ", "Sxw", "tar", "tgz", "TIF", "tiff", "TXT", "sealing", "WAV", "WMA", "WMV ", "XL S "," XML "," Zip "};< br> typeconfig [" file "]. deniedextensions = new string [] {};
string filepath = "% userfilespath %" + m_username + "/file/";
typeconfig ["file"]. filespath = filepath;
typeconfig ["file"]. filesabsolutepath = (userfilesabsolutepath = ""? "": "% Userfilesabsolutepath % file/");
typeconfig ["file"]. quickuploadpath = filepath; // "% userfilespath %" + m_username + "/";
typeconfig ["file"]. quickuploadabsolutepath = filepath; // (userfilesabsolutepath = ""? "": "% Userfilesabsolutepath %");
typeconfig ["image"]. allowedextensions = new string [] {"BMP", "GIF", "Jpeg", "jpg", "PNG" };< br> typeconfig ["image"]. deniedextensions = new string [] {};
string ImagePath = "% userfilespath %" + m_username + "/image/";
typeconfig ["image"]. filespath = ImagePath;
typeconfig ["image"]. filesabsolutepath = (userfilesabsolutepath = ""? "": "% Userfilesabsolutepath % image/");
typeconfig ["image"]. quickuploadpath = ImagePath; // "% userfilespath %" + m_username + "/";
typeconfig ["image"]. quickuploadabsolutepath = (userfilesabsolutepath = ""? "": "% Userfilesabsolutepath %");
typeconfig ["Flash"]. allowedextensions = new string [] {"SWF", "FLV" };
typeconfig ["Flash"]. deniedextensions = new string [] {};
typeconfig ["Flash"]. filespath = "% userfilespath % Flash/";
typeconfig ["Flash"]. filesabsolutepath = (userfilesabsolutepath = ""? "": "% Userfilesabsolutepath % Flash/");
typeconfig ["Flash"]. quickuploadpath = "% userfilespath %";
typeconfig ["Flash"]. quickuploadabsolutepath = (userfilesabsolutepath = ""? "": "% Userfilesabsolutepath %");
typeconfig ["Media"]. allowedextensions = new string [] {"AIFF", "ASF", "Avi", "BMP", "FLA", "FLV", "GIF", "Jpeg ", "jpg", "mid", "mov", "MP3", "MP4", "MPC", "MPEG", "MPG", "PNG", "QT ", "Ram", "RM", "RMI", "rmvb", "SWF", "TIF", "tiff", "WAV", "WMA ", "WMV" };
typeconfig ["Media"]. deniedextensions = new string [] {};
typeconfig ["Media"]. filespath = "% userfilespath % media/";
typeconfig ["Media"]. filesabsolutepath = (userfilesabsolutepath = ""? "": "% Userfilesabsolutepath % media/");
typeconfig ["Media"]. quickuploadpath = "% userfilespath %";
typeconfig ["Media"]. quickuploadabsolutepath = (userfilesabsolutepath = ""? "": "% Userfilesabsolutepath %");
}