Drupal_CKFinder配置_The server returned an empty response

其实,CKEditor & CKFinder 的组合,配置起来确实很麻烦(本文后面附配置过程)

我差一点也放弃了要使用IMCE代替CKFinder


先说说这个问题,The server returned an empty response

如图,比如我们要上传图片



当点击【Browse Server】按钮后,弹出一个空的Window,并且报错



It was not possible to load the XML response from the web server. The server returned an empty response.

服务器返回了空的回应。


网上相关的回复有:

http://drupal.org/node/695192

http://drupal.stackexchange.com/questions/31711/ckfinder-clicking-send-it-to-the-server-when-uploading-an-image-does-nothing


其实我们都是按照CKEditor官方手册来安装和配置 CKFinder 的

我就一个地方自做主张了

在 CKFinder configuration file (ckfinder/config.php) a中添加下面这句代码时:
        require_once '../../../../../modules/ckeditor/includes/filemanager.config.php';
我添加的是

require_once '../includes/filemanager.config.php';

因为 filemanager.config.php对ckfinder/config.php的相对路径我发现不是 ../../../../modulues/ckeditor/includes/

 

还是照手册的来就解决这个问题了

 

 


如果实在还是不行,还有2个方法供参考:

1,

If any of you still see the problem even after following all the steps mentioned in the manual, make sure that you create a folder in the server based on this url.

I fixed my problem by changing this
$baseUrl = 'files/ckfinder/userfiles/';

I also created folders and gave write permission and now its fixed.

2,

放弃CKFinder, 用 IMCE 代替


从其他大虾那里学到的解决问题的思路可以参考下(虽然没有给解决本文的问题提供帮助):

The server returned an empty response" most of the times happens in the PHP version.
PHP is often configured to not display error when they happen. As a result, if you for example forgot to add a semicolon in a PHP file and a fatal error occurs, the PHP script returns just a blank page.

To find out what's the problem you can do the following:
- enable error_reporting and set display_errors to "on" in php.ini
- check error logs.


in core\connector\php\connector.php add the following:

error_reporting(E_ALL);
ini_set('display_errors', 1);



下面是配置CKEditor 和 CKFinder 的详细说明:


在CKEditor的目录下面,找到 Readme.txt

目录如下:

TABLE OF CONTENTS
-----------------
 * Overview
 * More Information and License
 * Requirements
 * Installation Paths
 * Installation / Configuration
 * Installation Troubleshooting
 * Uploading Images and Files
 * Installing CKFinder
 * Managing Plugins
 * Installing Additional Plugins
 * Integrating a Plugin with the CKEditor Module (for Plugin Developers)
 * Setting up Security Filters
 * HTML Filters and Inline Styling
 * Integrating a Custom Security Filter with the CKEditor Module (for Developers)
 * Upgrading Instructions
 * Help & Contribution
 * Credits




1,总览

2,更多信息和许可

3,需要的支持

4,安装路径

5,安装/配置

6,安装答疑

7,上传图片和文件

8,安装CKFinder

9,管理插件

10,安装额外的插件

11,集成一个插件到CKEditor模块(针对插件开发者)

12,设置安全过滤器

13,HTML过滤器和内联样式

14,集成一个自定义的安全过滤器到CKEditor模块

15,更新指导

16,帮助……



Requirements 最低环境配置
------------
  - Drupal 7.x,
  - PHP 5.2 or greater,
  - CKEditor 3.4 or greater.
    You will need to download CKEditor from the official download site: http://ckeditor.com/download.
    It is recommended to always use the latest CKEditor version available.

Installation Paths 安装路径
------------------
It is recommended to install the CKEditor for Drupal module in the "sites/all/modules" directory.

When adding the files for standalone CKEditor and CKFinder, you can use one of the following directories:
- "sites/all/modules/ckeditor/"
- "sites/all/libraries/"
and create a "ckeditor" or "ckfinder" directory inside.

The CKEditor module will automatically recognize the proper path to the editor and the file browser.

All installation and configuration instructions in this README file assume that you use the first option and place the CKEditor and CKFinder files in the "sites/all/modules/ckeditor/" directory. If you want to use the "sites/all/libraries/" directory, you will need to adjust the paths given in the instructions accordingly.

Installation / Configuration  安装和配置
----------------------------
Note: these instructions assume that you install the CKEditor for Drupal module in the
      "sites/all/modules" directory (recommended).

1,解压缩模块zip文件到 sites/all/modules

2,到CK官网下载最新的ckeditor,解压缩到sites/all/modules/ckeditor/ckeditor

3,到modules设置页面,启用ckeditor这个模块

4,给用户赋权限

5, "Administration panel > Configuration > Content Authoring > CKEditor" section.

调整CKEditor profiles(决定了对用户来说那些选项是可用的)

6,对于那些可以使用富文本编辑的用户,为了让富文本编辑正常工作你还需要配置你的过滤器;

要么允许那些用户使用Full HTML access,要么使用下面的标签<a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr>
      <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong>
      <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code>
      <cite> <embed> <object> <param> <strike> <caption> <tbody>
      To make copying the list easier, below all tags were placed in one line:
      <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption> <tbody>


如果你准备用CKEditor的Filtered HTML 输入格式,情参照后面13,HTML过滤器和内联样式


7. To have better control over line breaks, you may disable the line break converter
      for a given text format in the "Administration panel > Configuration > Content authoring > Text formats" section (recommended).
8.修改 ckeditor.config.js 来满足您自己的需求.
      Configuration options are described here:
      http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
      开发者指南 for CKEditor:
      http://docs.cksource.com/CKEditor_3.x/Developers_Guide

      警告:记得清楚浏览器缓存,在修改了任何的JS 文件后,否则你会发现你所做的修改都没有效果。




安装过程中的问题
----------------------------
如果安装后你发现没有看到CKEditor,请检查;

"sites/all/modules/ckeditor/ckeditor/" 应当包含:
ckeditor.js, config.js, contents.css
and directories: "skins", "themes", "lang", "images".

正确的目录机构:
modules               <dir>
   ckeditor           <dir>
      ckeditor.module
      ckeditor.admin.inc
      ...
      ckeditor        <dir>
         _source      <dir>
         images       <dir>
         lang         <dir>
         plugins      <dir>
         skins        <dir>
         themes       <dir>
         COPY_HERE.txt
         ckeditor.js
         ...

As noted above, alternatively the "sites/all/libraries/ckeditor" directory can be used.
The "libraries" directory is the default path when drush is used to download the editor JavaScript code.

If you are still experiencing problems with your CKEditor installation, scroll down to the "Help & Contribution" section.

上传图片和文件
--------------------------
2种方案:

- 用商业的文件浏览器 CKFinder (http://ckfinder.com), 一个先进的Ajax file manager;
- by using modules like IMCE.

To select a preferred file browser, adjust CKEditor profiles in the
"Administration panel > Configuration > Content Authoring > CKEditor" section.
In the "File browser settings" section you can choose which file browser will be used for each profile.
Note: in order to choose an upload module other than CKFinder, you should install an appropriate Drupal module first.

安装 CKFinder
-------------------
CKFinder is an Ajax-based file manager created by CKEditor developers: http://ckfinder.com/.

   1. 下载 CKFinder for PHP: http://ckfinder.com/download
   2. 解压缩到    "sites/all/modules/ckeditor/ckfinder" (或者"sites/all/libraries/ckfinder") folder.
      The correct directory structure is as follows:

      modules               <dir>
         ckeditor           <dir>
            ckeditor.module
            ckeditor.admin.inc
            ...
            ckeditor        <dir>
               _source      <dir>
               images       <dir>
               ckeditor.js
               ...
            ckfinder        <dir>
               core         <dir>
               ckfinder.php
               config.php
               ...

   3. 赋权限 "CKFinder access" 

       在"Administration panel > People > Permissions" .
     
   4. 编辑 CKFinder 配置文件 (ckfinder/config.php) :

      I) 删除 CheckAuthentication() function:
        (do not worry, this function is defined in filemanager.config.php, see below)

        function CheckAuthentication()       <- remove it
        {                                    <- remove it
           //WARNING : DO NOT simply...      <- remove it
           ...                               <- remove it
           return false;                     <- remove it
        }                                    <- remove it

      II) 找到  $baseDir = resolveUrl($baseUrl);  在后面添加:分两种情况

        - for CKFinder installed in the "sites/all/modules/ckeditor/ckfinder" directory:
        require_once '../../../../includes/filemanager.config.php';

        - for CKFinder installed in the "sites/all/libraries/ckfinder" directory:
        require_once '../../../../../modules/ckeditor/includes/filemanager.config.php';
       这个路径不要改动!!!!!否则导致  本文的问题The server returned an empty response
       
       

   5. 编辑 Drupal设置文件 (sites/default/settings.php) :

      I) Uncomment the $base_url variable and set the base URL of your website (without the trailing slash).

      II) Uncomment the $cookie_domain variable and set the domain name of your website.

   6. 选择 CKFinder 作为首选的文件浏览器
      "Administration panel > Configuration > Content Authoring > CKEditor" section

      (for a selected CKEditor profile scroll down to the "File browser settings" section).
      In the "File browser settings" section you may also change destination folders for files uploaded with CKFinder.


后面有空再翻译


Managing Plugins
----------------
If you want to manage CKEditor plugins for a profile, go to the "Administration panel > Configuration > Content Authoring > CKEditor" section. This section lets you choose plugins relevant for each CKEditor profile from a list.
In order to activate a plugin, go to the "Editor appearance > Plugins" section and select the checkbox next to a required plugin name.

If a plugin contains toolbar buttons, you will need to drag and drop them to an appropriate toolbar position by using the toolbar wizard. If this is the case, the button should be added to the CKEditor toolbar by using the method described below:
- Enter the "Editor appearance > Toolbar" section.
- Check whether the plugin button that you want to use is present in the "Used buttons" sections. If not, find it in the "All buttons" section and drag and drop to the toolbar configuration from the "Used buttons" section.

Alternatively, if you turned off the toolbar wizard and prefer to enter the toolbar configuration manually, you will need to add the plugin button by yourself by appending it to your toolbar definition code.

Please note that some plugins require installing additional modules to work correctly.

Installing Additional Plugins
-----------------------------
The installation process is based on placing the plugin folder in the "plugins" directory of the CKEditor module (usually "sites/all/modules/ckeditor").
The plugin folder should contain at least the plugin.js file that is responsible for the plugin logic.
The plugin description will be displayed in the "Administration panel" if it is added to the plugin.js file by using the following special comment:
/**
 * @file Plugin description
 */
Hint: The "Administration panel" automatically detects the toolbar buttons available in the plugin and adds them to the toolbar wizard.

A plugin can be enabled by using the same method as described above - see the "Managing Plugins" section.

Integrating a Plugin with the CKEditor Module (for Plugin Developers)
---------------------------------------------------------------------
Integrating your application with the CKEditor module by adding a plugin works through a special hook.
An example of the hook is shown below:

function MODULENAME_ckeditor_plugin() {
  return array(
        'plugin_name' => array(
            // Plugin name.
            'name' => 'plugin_name',
            // Plugin description - it will be displayed in the plugins management section of the profile settings.
            'desc' => t('Plugin description'),
            // The full path to the CKEditor plugin directory, trailing slash included.
            'path' => drupal_get_path('module', 'my_module') . '/plugin_dir/',
            // Plugin buttons definition (optional).
            'buttons' => array(
              'button_name' => array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
              'button_name' => array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
              ...
            )
        )
    );
}
Please note that MODULENAME in the code above is the name of the module.

After the hook is used the plugin will automatically appear on the plugin list for each CKEditor profile where you will be able to enable it as described in the "Managing Plugins" section.

Setting up Security Filters
---------------------------
The CKEditor security system protects you from executing malicious code that is already in your database. In plain textareas database content is harmless because it is not executed, but a WYSIWYG editor interprets HTML like a Web browser and thus the content needs to be filtered before it is loaded.

In order to configure the security filters, go to the "Administration panel > Configuration > Content Authoring > CKEditor" section. Enter the profile configuration and go to the "Security" section.

The "Security" section lists all the security filters that are currently supported by the CKEditor for Drupal module along with their status for each text format.

The CKEditor for Drupal module has built-in support for some popular security filter modules which you will need to download and install by yourself first. Visit the official websites for each module in order to get the files and find installation and configuration instructions.

When a filter module is installed, you will be able to configure its security filters and enable for a given text format. The list of active text formats is displayed in the "Security" section along with the links that will take you to the "Administration panel > Configuration > Content authoring > Text formats" section where you will be able to configure the filters for each of the text formats. The filters will then be run on the content during the filtering process.

The "Security Settings" option in the "Security" section lets you choose whether to always run the security filters on CKEditor content (recommended and default option) or run them only when CKEditor is set to start automatically. If you change this setting to only run the filters when CKEditor starts automatically, you will not be protected when toggling manually between a plain textarea and the WYSIWYG editor.

The following security filter modules are currently supported:
 - HTML Purifier - http://drupal.org/project/htmlpurifier
 - htmLawed - http://drupal.org/project/htmLawed
 - Htmltidy - http://drupal.org/project/htmltidy
 - WYSIWYG Filter - http://drupal.org/project/wysiwyg_filter

HTML Filters and Inline Styling
-------------------------------
In the "Administration panel > Configuration > Content Authoring > Text fromats" section, Filtered HTML is the default filter.
Due to security reasons enabling Full HTML is only an option for trusted users.

To take full advantage of using CKEditor you can extend the list of allowed tags in the HTML filter that is enabled in the Filtered HTML input format. If you do not do this, you may notice that a page created in CKEditor looks different after saving.

Unfortunately, even if you extend the list of allowed tags, one problem still remains: Filtered HTML not only strips disallowed tags, but also strips inline style definitions. It basically means that you are unable to apply a different font color, size or family, align images etc. using CKEditor out of the box.

You can solve this problem by creating another input format that will work in a similar way as Filtered HTML (will only allow specified tags), but in a much better way - i.e. it will not strip inline styles that CKEditor is using when
formatting text or images after the page is saved. To create such an input format, you will need an HTML filter. See the list of HTML filter modules that are supported by the CKEditor module in the "Setting up Security Filters" section above.

It is up to you to decide which one to use. Just make sure that you will only allow to use proper inline styles, tags, and attributes.

Integrating a Custom Security Filter with the CKEditor Module (for Developers)
------------------------------------------------------------------------------
Integrating your application with the CKEditor module by adding a security filter works through a special hook.
An example of the hook is shown below:

function MODULENAME_ckeditor_security_filter() {
    return array(
        'security_filter_name' => array(
            // Security filter title - it would be displayed in the "Security > Security filters" section of profile settings.
            'title' => t('Security filter title'),
            // Security filter description - it would be displayed in the "Security > Security filters" section of profile settings.
            'description' => t('Security filter description'),
        )
    );
}
Please note that MODULENAME in the code above is the name of the module.

After the hook is used the security filter will automatically appear on the filters list for each CKEditor profile where you will be able to enable it as described in the "Setting up Filters" section.

Upgrading Instructions
----------------------
This instruction assumes that you are upgrading the CKEditor module [M] and CKEditor (the editor) [E] at the same time.
Instructions specific for module upgrades are tagged with [M]. Steps that must be taken when upgrading CKEditor (the editor) are marked with [E].

   1. [M] Download the latest version of the CKEditor module from http://drupal.org/project/ckeditor (it is advised to read the release notes before going further).
   2. [E] Download the latest version of CKEditor from http://ckeditor.com/download (it is advised to read the "What's New" page before going further: http://ckeditor.com/whatsnew).
   3. [M] Back up your database.
   4. [EM] Place the site in the "Off-line" mode to let the database updates run without interruption and to avoid displaying errors to end users of the site.
   5. [E] If you are using CKFinder, make sure you will not delete it, and move it to a safe place.
   6. [E] If you introduced any changes (e.g. custom toolbar definitions etc.) in the sites/all/modules/ckeditor/ckeditor.config.js file (or sites/all/modules/ckeditor/ckeditor/config.js), write down your changes and add them again after uploading new files.
          In general, try to avoid making any changes to CKEditor's config.js file and add everything to ckeditor.config.js.
   7. Delete old files:
      [EM]* Simply remove the "modules/ckeditor" directory if upgrading both the editor and the module.
      [M] If you are upgrading the module only, remember to leave the "modules/ckeditor/ckeditor" directory untouched.
      [E] When upgrading the editor, remove the contents of the "modules/ckeditor/ckeditor" directory only.
      WARNING: If you do not remove old files and just rename the "ckeditor" directory instead (e.g. to "ckeditor_old"), Drupal may use the module from the renamed "ckeditor_old" directory.
   8. [M] Upload the CKEditor module (extracted files and folders) to the "sites/all/modules" directory.
   9. [E] Upload standalone CKEditor (extracted files and folders from the "ckeditor" directory) to the "sites/modules/ckeditor/ckeditor" directory (i.e. where the COPY HERE.txt file exists).
   10. [E] Restore the CKFinder  files from where you copied them (see step 5).
   11. [E] Apply your modifications to default configuration in the ckeditor.config.js file (see step 6).
   12. [M] Run update.php.
   13. [EM] Put the site back online.

Help & Contribution
-------------------
If you are looking for more information, have any trouble with the configuration of the module
or if you found an issue, please visit the official project page:
  http://drupal.org/project/ckeditor

Having problems? Take a look at the list of common problems when installing CKEditor:
  http://docs.cksource.com/CKEditor_for_Drupal/Troubleshooting

Learn how to adjust CKEditor to your theme and configure the spellchecker:
  http://docs.cksource.com/CKEditor_for_Drupal/Tricks

If you would like to help in the development of the module, we encourage you to join our team.
Any help will be greatly appreciated!

Credits
-------
 - CKEditor for Drupal is currently maintained by the CKEditor team and Jorrit Schippers.
     http://ckeditor.com/

 - CKEditor - The text editor for the Internet
     Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
     http://cksource.com/





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值