Add ckfinder to Drupal FCKeditor module
This note was taken on Drupal-5.7, fckeditor-5.x-2.1 (module), fckeditor-2.5.1, and ckfinder-1.1.
- Locate the file named settings.php inside your drupal directory (usually sites/default/settings.php) and set $cookie_domain variable to the appropiate domain (remember to uncomment that line). If you do not do this, FCKeditor will claim that file browser is disabled.
- Download ckfinder and put it inside the directory of fckeditor module, after which you will see something like below:
% ls
CHANGELOG.txt fckeditor.info filemanager.config.php
ckfinder fckeditor.install img_assist_fckeditor.js
ckfinder_php_1.1.tar.gz fckeditor.module LICENSE.txt
fckeditor plugins FCKeditor_2.5.1.tar.gz
fckeditor.popup.html po fckeditor.config.js
fckeditor.popup.js fckeditor.css fckeditor.utils.js
README.txt - Edit the fckconfig.js file in the FCKeditor directory and modify the following settings:
FCKConfig.LinkBrowserURL = '/ckfinder/ckfinder.html' ;
FCKConfig.ImageBrowserURL = '/ckfinder/ckfinder.html?type=Images' ;
FCKConfig.FlashBrowserURL = '/ckfinder/ckfinder.html?type=Flash' ;
FCKConfig.LinkUploadURL = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files' ;
FCKConfig.ImageUploadURL = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images' ;
FCKConfig.FlashUploadURL = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash' ; - Edit
fckconfig.modulefckeditor.module, and replace the linesif ($advanced_uploads) {
$element['#suffix'] .= $js_id .".Config['LinkBrowserURL'] = \"". $module_full_path ."/fckeditor/editor/filemanager/browser/default/browser.html?Connector=". $connector_path ."&ServerPath=". $files_path ."\";
". $js_id .".Config['ImageBrowserURL'] = \"". $module_full_path ."/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=". $connector_path ."&ServerPath=". $files_path ."\";
". $js_id .".Config['FlashBrowserURL'] = \"". $module_full_path ."/fckeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=". $connector_path ."&ServerPath=". $files_path ."\";\n";
}
with the following:if ($advanced_uploads) {
$element['#suffix'] .= $js_id.".Config['LinkBrowserURL'] = '".$module_full_path."/ckfinder/ckfinder.html';
".$js_id.".Config['ImageBrowserURL'] = '".$module_full_path."/ckfinder/ckfinder.html?type=Images';
".$js_id.".Config['FlashBrowserURL'] = '".$module_full_path."/ckfinder/ckfinder.html?type=Flash';\n";
} - Open file ckfinder/config.php, and replace the empty function CheckAuthentication() with the following code:
function CheckAuthentication()
{
static $authenticated;if (!isset($authenticated)) {
$drupal_path = "../../../";
if(!file_exists($drupal_path . "/includes/bootstrap.inc")) {
$drupal_path = "../..";
do {
$drupal_path .= "/..";
$depth = substr_count($drupal_path, "..");
}
while(!($bootstrapFileFound = file_exists($drupal_path . "/includes/bootstrap.inc")) && $depth<10);
}
if (!isset($bootstrapFileFound) || $bootstrapFileFound) {
$cwd = getcwd();
chdir($drupal_path);
require_once "./includes/bootstrap.inc";
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$authenticated = user_access("allow fckeditor file uploads");
chdir($cwd);
}
}return $authenticated;
}
$Config['Enabled'] = CheckAuthentication();Please note that you must call this function right after declaration, otherwise the "session_start()" function call inside bootstrap.inc will cause error.
Source : http://www.daisybeckenbach.com/technologies/add-ckfinder-drupal-fckeditor-module