• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

FCKEditor v2.6 编辑器配置图解教程

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
集成 FCKEditor v2.6(当前为最新版本)的基本步骤如下:
1. 下载FCKeditor 2.6 基本文件(Main Code)。将解压缩的文件复制到项目的editors/FCKEditorV2 目录下。  
2. 下载 FCKeditor.Net / ASP.NET 控件,复制FredCK.FCKeditorV2.dll 文件到项目的bin目录。

这样就基本可以FCKEditor v2.6 超强的编辑器了,当然还需要在Host Settings中设置默认的编辑器。
关于 FCKEditor 的一些基本配置信息,请参考如下的文章:

如需要使用文件上传功能,还需要修改代码FCKEditorV2/editor/filemanager/connectors/config.ascx(以ASPX代码为例)。这里限制只有登录的用户才可以使用文件上传功能,并且上传的文件只能上传到用户自己的目录。根据每个用户名自动创建对应的文件上传目录。


connectors/config.ascx 更新后的代码如下:
复制代码 代码如下:

/**
* 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 as...
//
// return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
//
// ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
// 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 the
// 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 the
// 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 the
// 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", "vsd", "wav", "wma", "wmv", "xls", "xml", "zip" };
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" };
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%" );
}

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Qzone编辑器QzoneEditor打包下载发布时间:2022-02-05
下一篇:
asp.net 为FCKeditor开发代码高亮插件实现代码发布时间:2022-02-05
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap