KCFinderの設定について。 | φ(..)メモとして残しておこう…

KCFinderの設定について。

とりあえず、config.php


$_CONFIG = array(

'disabled' => false,
'readonly' => false,
'denyZipDownload' => true,

'theme' => "oxygen",

//アップロードフォルダ
'uploadURL' => "upload",
'uploadDir' => "",

'dirPerms' => 0755,
'filePerms' => 0644,

'deniedExts' => "exe com msi bat php cgi pl",

'types' => array(

// CKEditor & FCKEditor types
'files' => "",
'flash' => "swf",
'images' => "*img",

// TinyMCE types
'file' => "",
'media' => "swf flv avi mpg mpeg qt mov wmv asf rm",
'image' => "*img",
),

'mime_magic' => "",

'maxImageWidth' => 0,
'maxImageHeight' => 0,

'thumbWidth' => 100,
'thumbHeight' => 100,

'thumbsDir' => ".thumbs",

'jpegQuality' => 90,

'cookieDomain' => "",
'cookiePath' => "",
'cookiePrefix' => 'KCFINDER_',

// THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION CONFIGURATION

//KCFinderから見たtinymce.jsの場所
'_tinyMCEPath' => "../jscripts/tiny_mce",

'_sessionVar' => &$_SESSION['KCFINDER'],

);



core/autoload.php


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

function __autoload($class) {
if ($class == "uploader")
require "core/uploader.php";
elseif ($class == "browser")
require "core/browser.php";
elseif (file_exists("core/types/$class.php"))
require "core/types/$class.php";
elseif (file_exists("lib/class_$class.php"))
require "lib/class_$class.php";
elseif (file_exists("lib/helper_$class.php"))
require "lib/helper_$class.php";
}



そして、肝心の編集ページのtinyMCE.init()の中はこんな感じ。



// General options
mode : "textareas",
theme : "advanced",
convert_urls: false,
plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
//日本語にします
language : "ja", // Theme options

//KCFinderの呼び出し
file_browser_callback: 'openKCFinder'
,

// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,

// Example content CSS (should be your site CSS)
content_css : "css/content.css",

// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",

});

//---[KCFinder]---
function openKCFinder(field_name, url, type, win) {
tinyMCE.activeEditor.windowManager.open({
file: '../kcfinder/browse.php?opener=tinymce&type=' + type,
title: 'KCFinder',
width: 700,
height: 500,
resizable: "yes",
inline: true,
close_previous: "no",
popup_css: false
}, {
window: win,
input: field_name
});
return false;
}
//---[KCFinder]---




とりあえず、tinyMCEにKCFinderを組み込んだときに動かないのはクルクル σ@( ゚∀ ゚) パー!?ミッションの設定が問題になっているパターンが多い。

kcfinderの下のphpファイルは755に。
kcfinder/coreの中のphpも755に。
kcfinder/core/typesの下のphpも755…って感じで設定する。

upload用のフォルダは777に設定しておけば間違いない。


確認は、kcfinder/browse.phpを直接叩いてみるって手も。


openKCFinder()の中のfile: '../kcfinder/browse.php?opener=tinymce&type=' + type,で開いている通りなのだから、tinyMCEとかとりあえず関係なく、直接見に行ってみること。