В процессе создания одного сайта столкнулся с отсутствием поддержки CKFinder в модуле FCKEditor для Drupal.
Поковырявшись в интернетах и исходниках модуля, состряпал следующее решение это проблемы:
- В
settings.php
вашего сайта (обычно этот файл находится здесь:sites/default/settings.php
) найдите и раскомментируйте параметр$cookie_domain
(если он закомментирован, конечно, в случае, если он уже раскомментирован — убедитесь, что его значение корректно). Если этот параметр не будет установлен или будет установлен неверно, то FCKEditor откажется загружать CKFinder под предлогом, что браузер файлов отключен. - Скачайте дистрибутив CKFinder и распакуйте его в директорию модуля.
- Откройте файл
fckeditor.config.js
в корневой директории модуля и добавьте в конец следующие строки: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';
- Откройте файл
fckeditor.module
, найдите следующие строки:if ($advanced_uploads) { $js .= $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"; }
и замените их на:
if ($advanced_uploads) { $js .= $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"; }
- Откройте файл
ckfinder/config.php
, найдите пустую функциюCheckAuthentication
и замените её: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();
далее найдите параметр
$baseUrl
и установите его значение:$baseUrl = '/' . file_directory_path() . '/';
- Enjoy.
К сожалению, сайт некого voyageur, автора оригинального решения, на котором базируется моё, в настоящий момент в дауне, поэтому ссылку не привожу.