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

集成 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)

相关推荐

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

    集成 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中设置默认的编辑器. 关于 FCKEdito

  • phpmyadmin3 安装配置图解教程

    在PHP网站开发中,最基本的PHP环境搭建涉及PHP.Apache/IIS.Mysql,对于数据库的管理,除了Mysql数据库自身提供了命令行工具方便开发人员管理数据库外,基于PHP开发的phpmyadmin也是一个非常好用的Mysql数据库管理程序,在xampp等PHP环境配置安装程序中,phpmyadmin也是一个必备的PHP程序.今天和大家分享如何安装.配置phpmyadmin. phpmyadmin安装配置准备工作 首先当然是下载phpmyadmin的安装包,提供两个phpmyadmin

  • windows下MySQL 5.7.3.0安装配置图解教程(安装版)

    首先MySQL官方网站从http://dev.mysql.com/downloads/下载MySQL服务器安装软件包,我下载为版本" mysql-installer-community-5.7.3.0-m13.msi"不多说,双击进入安装. 如下图: 点击上图红框"Install MySQL Products"进入安装界面,如下图: 根据上图当中第一步骤与第二步骤,进入下图: 进入设置界面,如下图: 在原来旧的版本当中,安装类型有3种安装类型:Typical(典型安

  • WIN2003系统IIS下PHP5+MySQL5+ZendOptimizer配置图解教程第1/3页

    一.下载好php5.mysql5及ZendOptimizer和phpmyadmin的安装程序PHP下载地址http://www.php.net/downloads.phpMySQL 4下载地址http://dev.mysql.com/downloads/mysql/4.1.htmlMySQL 5下载地址http://dev.mysql.com/downloads/mysql/5.0.htmlZendOptimizer下载地址(需注册)http://www.zend.com/store/free_

  • SQL Server 2008 安装和配置图解教程(附官方下载地址)

    SQL Server 2008我们也能从中体验到很多新的特性,但是对于SQL Server 2008安装,还是用图来说话比较好.本文将从SQL Server 2008安装开始讲起. SQL Server 2008 简体中文正式版 下载地址 http://www.jb51.net/softs/43885.html 本来这篇是打算玩玩服务器功能中的第一个:adrms的,没想到装了几次都安装成功,但是有错误,后来没招了,打算将rms的数据库放到sql上来折腾折腾,所以为了不让大家觉得突兀,所以本篇SQ

  • Ubuntu Server 18.04.5 LTS服务器版安装配置图解教程

    一.Ubuntu Server 18.04.5 LTS系统安装 Ubuntu分为桌面版(desktop)和服务器版(Server),下面为大家介绍服务器版本Ubuntu Server 18.04.5 LTS的详细安装过程. Ubuntu Server 18.04.5 LTS离线安装镜像下载地址: ubuntu 18.04 LTS Server 点击下载 ps:此链接下载的是iso镜像 http://cdimage.ubuntu.com/ubuntu/releases/18.04.5/releas

  • 针对PHP环境下Fckeditor编辑器上传图片配置详细教程

    开启Fckeditor上传图片功能 考虑到目录安全性问题,默认Fckeditor2.6.6上传功能并未开启,所以第一步我们必须开启Fckeditor上传功能,这里需要注意,由于PHP版本Fckeditor上传功能需要用到chomod函数对新建目录进行权限设置,所以请务必确认在启用Fckeditor上传功能时PHP环境的用户具有创建和更改上传目录的权限. 如果没有开启Fckeditor上传功能,在点击插入/编辑图像按钮,选择上传,在选择完要上传的文件后点击发送到服务器上按钮时会报错误信息如下 复制

  • YII中Ueditor富文本编辑器文件和图片上传的配置图文教程

    将Ueditor集成到YII框架中后,参照editor_config.js中的toolbars中的内容,更改options中标签可以给编辑器添加想要的功能: 因此要想添加文件和图片上传功能,应该加入以下两个标签: 文本编辑器中便出现了对应的两个选项: 但是点击上传图片按钮后发现,无法正常进行图片上传,文件上传也是失败的,问题都是Flash Player需要升级, 因此在火狐浏览器中安装对应的flash player组件,选择其中一个工作: 此时,文件上传和图片上传功能就能正常使用了: 上传路径的

  • FCKeditor 网页在线编辑器的使用方法

    它不需要安装任何形式的客户端,兼容绝大多数主流浏览器,支持ASP.Net.ASP.ColdFusion .PHP.Jsp.Active-FoxPro.Lasso.Perl.ython 等编程环境. 官方网站 http://www.fckeditor.net/ 官方文档 http://wiki.fckeditor.net/ 下载地址 http://www.fckeditor.net/download/default.html FCKeditor安装和配置 下载FCKeditor2.63.zip和F

  • BIOS设置图解教程 Award Bios最新(转)

    在前文中已经了解了一些Bios的基本知识,和设置,那么在这篇文章里面我就会更详细的介绍一下Bios的超频设置,希望对那些想超频但是又没有接错过超频的玩家能有一些帮助. 和AMI Bios一样,再开机画面时按下"Del"键进入Bios设置菜单(有些是按F1键): 进入后大家会看到以下菜单,也有可能会有一些差别,但是基本上是差不多的,及算名字不同,但是基本上作用是一样的 大家可以用方向键移动光标,回车键确认,ESC键返回,用PageUp,PageDown和数字键键调整设置,在任何设置菜单中

随机推荐