3 PHP Connector for the FCKEditor v2 File Manager
4 Written By Akira Taniguchi, JP, Dec 2006
5 http://akira.matrix.jp/
7 FCKEditor - By Frederico Caldeira Knabben
8 http://www.fckeditor.net/
13 2008.6.8 modified by naoki hirata
14 2009.2.10 mbstringなしでも実行できるように修正 by naoki hirata
15 2010.3.30 ユーザ種別に応じたのディレクトリの自動設定を追加 by naoki hirata
16 2010.7.14 フォルダ情報取得機能追加 by naoki hirata
18 /*------------------------------------------------------------------------------*/
19 /* Encoding of file system */
20 /*------------------------------------------------------------------------------*/
21 $fckphp_config['FileEncoding'] = 'UTF-8';
22 /*==============================================================================*/
24 /*------------------------------------------------------------------------------*/
25 /* Path to user files relative to the document root (no trailing slash) */
26 /*------------------------------------------------------------------------------*/
27 //$fckphp_config['UserFilesPath'] = "/UserFiles";
28 // Magic3のリソースディレクトリ(ルート/resource)をユーザ利用可能にする
29 //$fckphp_config['UserFilesPath'] = $gEnvManager->getRelativeResourcePathToDocumentRoot();
30 $fckphp_config['UserFilesPath'] = $gEnvManager->getRelativeResourcePathToDocumentRootForUser(); // ユーザ種別に対応(2010.3.30)
31 /*==============================================================================*/
33 /*------------------------------------------------------------------------------*/
35 /*------------------------------------------------------------------------------*/
36 $fckphp_config['UseCache'] = 0; // 0/1 = Unuse / Use
37 /*==============================================================================*/
39 /*------------------------------------------------------------------------------*/
40 /* Global Disk Quota - Max size of all resource areas */
41 /*------------------------------------------------------------------------------*/
42 $fckphp_config['DiskQuota']['Global'] = 50; //In MBytes (default: 50mb)
43 /*==============================================================================*/
45 /*------------------------------------------------------------------------------*/
46 /* Per resource area settings:- */
47 /* - AllowedExtensions :: Array, allowed file extensions (in lowercase) */
48 /* - AllowedMIME :: Array, allowed mime types (in lowercase) */
49 /* - MaxSize :: Number, Maximum size of file uploads in KBytes */
50 /* - DiskQuota :: Number, Maximum size allowed for the resource area in MByte */
51 /* - HideFolders :: Array, RegExp, matching folder names will be hidden */
52 /* - HideFiles :: Array, RegExp, matching file names will be hidden */
53 /*------------------------------------------------------------------------------*/
55 $fckphp_config['ResourceAreas']['File'] = array();
56 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'] = array();
57 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "zip";
58 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "doc";
59 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "xls";
60 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "pdf";
61 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "rtf";
62 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "csv";
63 /*$fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "jpg";
64 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "gif";
65 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "jpeg";
66 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "png";
67 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "avi";
68 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "mpg";
69 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "mpeg";
70 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "swf";
71 $fckphp_config['ResourceAreas']['File']['AllowedExtensions'][] = "fla";*/
72 $fckphp_config['ResourceAreas']['File']['AllowedMIME'] = array();
73 $fckphp_config['ResourceAreas']['File']['MaxSize'] = 1024 * 20; // KBytes
74 $fckphp_config['ResourceAreas']['File']['DiskQuota'] = 50; // MBytes
75 $fckphp_config['ResourceAreas']['File']['HideFolders'] = array("^\.");
76 $fckphp_config['ResourceAreas']['File']['HideFiles'] = array("^\.");
79 $fckphp_config['ResourceAreas']['Image'] = array();
80 $fckphp_config['ResourceAreas']['Image']['AllowedExtensions'] = array();
81 $fckphp_config['ResourceAreas']['Image']['AllowedExtensions'][] = "jpg";
82 $fckphp_config['ResourceAreas']['Image']['AllowedExtensions'][] = "gif";
83 $fckphp_config['ResourceAreas']['Image']['AllowedExtensions'][] = "jpeg";
84 $fckphp_config['ResourceAreas']['Image']['AllowedExtensions'][] = "png";
85 $fckphp_config['ResourceAreas']['Image']['AllowedMIME'] = array();
86 $fckphp_config['ResourceAreas']['Image']['MaxSize'] = 1024 * 20; // KBytes
87 $fckphp_config['ResourceAreas']['Image']['DiskQuota'] = 50; // MBytes
88 $fckphp_config['ResourceAreas']['Image']['HideFolders'] = array("^\.");
89 $fckphp_config['ResourceAreas']['Image']['HideFiles'] = array("^\.");
92 $fckphp_config['ResourceAreas']['Flash'] = array();
93 $fckphp_config['ResourceAreas']['Flash']['AllowedExtensions'] = array();
94 $fckphp_config['ResourceAreas']['Flash']['AllowedExtensions'][] = "swf";
95 $fckphp_config['ResourceAreas']['Flash']['AllowedExtensions'][] = "fla";
96 $fckphp_config['ResourceAreas']['Flash']['AllowedMIME'] = array();
97 $fckphp_config['ResourceAreas']['Flash']['MaxSize'] = 1024 * 20; // KBytes
98 $fckphp_config['ResourceAreas']['Flash']['DiskQuota'] = 50; // MBytes
99 $fckphp_config['ResourceAreas']['Flash']['HideFolders'] = array("^\.");
100 $fckphp_config['ResourceAreas']['Flash']['HideFiles'] = array("^\.");
103 $fckphp_config['ResourceAreas']['Media'] = array();
104 /*$fckphp_config['ResourceAreas']['Media']['AllowedExtensions'] = array();
105 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "swf";
106 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "fla";
107 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "jpg";
108 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "gif";
109 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "jpeg";
110 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "png";*/
111 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "mov";
112 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "ra";
113 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "ram";
114 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "rm";
115 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "avi";
116 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "mpg";
117 $fckphp_config['ResourceAreas']['Media']['AllowedExtensions'][] = "mpeg";
118 $fckphp_config['ResourceAreas']['Media']['AllowedMIME'] = array();
119 $fckphp_config['ResourceAreas']['Media']['MaxSize'] = 1024 * 20; // KBytes
120 $fckphp_config['ResourceAreas']['Media']['DiskQuota'] = 50; // MBytes
121 $fckphp_config['ResourceAreas']['Media']['HideFolders'] = array("^\.");
122 $fckphp_config['ResourceAreas']['Media']['HideFiles'] = array("^\.");
124 /*==============================================================================*/
127 /*------------------------------------------------------------------------------*/
128 /* Directory and File Naming :- */
129 /* -AvailableMax :: Maximum number of available files */
130 /* -DisableName :: Disable name (regexp) */
131 /*------------------------------------------------------------------------------*/
132 $fckphp_config['AvailableMax'] = 200;
133 $fckphp_config['DisableName'] = '(^\..*$|^.*\.$)';
134 $fckphp_config['DisableChars'] = '[\\/:"*?<>|]'; // .*, *., \/:,;"*?<>|
135 /*==============================================================================*/
137 /*------------------------------------------------------------------------------*/
139 /* ResourceTypes :: Array of valid resource areas */
140 /* Commands :: Array of valid commands accepted by the connector */
141 /*------------------------------------------------------------------------------*/
142 $fckphp_config['ResourceTypes'] = array();
143 $fckphp_config['ResourceTypes'][] = 'File';
144 $fckphp_config['ResourceTypes'][] = 'Image';
145 $fckphp_config['ResourceTypes'][] = 'Flash';
146 $fckphp_config['ResourceTypes'][] = 'Media';
148 $fckphp_config['Commands'] = array();
149 $fckphp_config['Commands'][] = "CreateFolder";
150 $fckphp_config['Commands'][] = "GetFolders";
151 $fckphp_config['Commands'][] = "GetFoldersAndFiles";
152 $fckphp_config['Commands'][] = "FileUpload";
153 $fckphp_config['Commands'][] = "Thumbnail";
154 $fckphp_config['Commands'][] = "DeleteFile";
155 $fckphp_config['Commands'][] = "DeleteFolder";
156 $fckphp_config['Commands'][] = "RenameFile";
157 $fckphp_config['Commands'][] = "RenameFolder";
158 $fckphp_config['Commands'][] = "GetFolderInfo"; // フォルダ情報取得(2010.7.14)
159 /*==============================================================================*/
162 /*------------------------------------------------------------------------------*/
164 /*------------------------------------------------------------------------------*/
165 $fckphp_config['mimeIcons'] = array();
166 $fckphp_config['mimeIcons']["image"] = "image.jpg";
167 $fckphp_config['mimeIcons']["audio"] = "sound.jpg";
168 $fckphp_config['mimeIcons']["video"] = "video.jpg";
169 $fckphp_config['mimeIcons']["text"] = "document2.jpg";
170 $fckphp_config['mimeIcons']["text/html"] = "html.jpg";
171 $fckphp_config['mimeIcons']["application"] = "binary.jpg";
172 $fckphp_config['mimeIcons']["application/pdf"] = "pdf.jpg";
173 $fckphp_config['mimeIcons']["application/msword"] = "document2.jpg";
174 $fckphp_config['mimeIcons']["application/postscript"] = "postscript.jpg";
175 $fckphp_config['mimeIcons']["application/rtf"] = "document2.jpg";
176 $fckphp_config['mimeIcons']["application/vnd.ms-excel"] = "document2.jpg";
177 $fckphp_config['mimeIcons']["application/vnd.ms-powerpoint"] = "document2.jpg";
178 $fckphp_config['mimeIcons']["application/x-tar"] = "tar.jpg";
179 $fckphp_config['mimeIcons']["application/zip"] = "tar.jpg";
180 $fckphp_config['mimeIcons']["message"] = "email.jpg";
181 $fckphp_config['mimeIcons']["message/html"] = "html.jpg";
182 $fckphp_config['mimeIcons']["model"] = "kmplot.jpg";
183 $fckphp_config['mimeIcons']["multipart"] = "kmultiple.jpg";
185 $fckphp_config['extIcons'] = array();
186 $fckphp_config['extIcons']["pdf"] = "pdf.jpg";
187 $fckphp_config['extIcons']["ps"] = "postscript.jpg";
188 $fckphp_config['extIcons']["eps"] = "postscript.jpg";
189 $fckphp_config['extIcons']["ai"] = "postscript.jpg";
190 $fckphp_config['extIcons']["ra"] = "real_doc.jpg";
191 $fckphp_config['extIcons']["rm"] = "real_doc.jpg";
192 $fckphp_config['extIcons']["ram"] = "real_doc.jpg";
193 $fckphp_config['extIcons']["wav"] = "sound.jpg";
194 $fckphp_config['extIcons']["mp3"] = "sound.jpg";
195 $fckphp_config['extIcons']["ogg"] = "sound.jpg";
196 $fckphp_config['extIcons']["eml"] = "email.jpg";
197 $fckphp_config['extIcons']["tar"] = "tar.jpg";
198 $fckphp_config['extIcons']["zip"] = "tar.jpg";
199 $fckphp_config['extIcons']["bz2"] = "tar.jpg";
200 $fckphp_config['extIcons']["tgz"] = "tar.jpg";
201 $fckphp_config['extIcons']["gz"] = "tar.jpg";
202 $fckphp_config['extIcons']["rar"] = "tar.jpg";
203 $fckphp_config['extIcons']["avi"] = "video.jpg";
204 $fckphp_config['extIcons']["mpg"] = "video.jpg";
205 $fckphp_config['extIcons']["mpeg"] = "video.jpg";
206 $fckphp_config['extIcons']["jpg"] = "image.jpg";
207 $fckphp_config['extIcons']["gif"] = "image.jpg";
208 $fckphp_config['extIcons']["png"] = "image.jpg";
209 $fckphp_config['extIcons']["jpeg"] = "image.jpg";
210 $fckphp_config['extIcons']["nfo"] = "info.jpg";
211 $fckphp_config['extIcons']["xls"] = "spreadsheet.jpg";
212 $fckphp_config['extIcons']["csv"] = "spreadsheet.jpg";
213 $fckphp_config['extIcons']["html"] = "html.jpg";
214 $fckphp_config['extIcons']["doc"] = "document2.jpg";
215 $fckphp_config['extIcons']["rtf"] = "document2.jpg";
216 $fckphp_config['extIcons']["txt"] = "document2.jpg";
217 $fckphp_config['extIcons']["xla"] = "document2.jpg";
218 $fckphp_config['extIcons']["xlc"] = "document2.jpg";
219 $fckphp_config['extIcons']["xlt"] = "document2.jpg";
220 $fckphp_config['extIcons']["xlw"] = "document2.jpg";
221 $fckphp_config['extIcons']["txt"] = "document2.jpg";
223 $fckphp_config['iconLookupDir'] = dirname($_SERVER['PHP_SELF']) . "/images/";
224 /*==============================================================================*/
226 /*------------------------------------------------------------------------------*/
227 /* HTTP over SSL Detection (shouldnt require changing */
228 /*------------------------------------------------------------------------------*/
229 $fckphp_config['prot'] = ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) ? "https://" : "http://");
230 /*==============================================================================*/
232 /*------------------------------------------------------------------------------*/
233 /* Prefix added to image path before sending back to editor */
234 /*------------------------------------------------------------------------------*/
235 $fckphp_config['urlprefix'] = "{$fckphp_config['prot']}{$_SERVER['SERVER_NAME']}";
236 /*==============================================================================*/
238 /*------------------------------------------------------------------------------*/
239 /* DIRECTORY_SEPARATOR */
240 /*------------------------------------------------------------------------------*/
241 if (! defined('DIRECTORY_SEPARATOR')) {
242 define('DIRECTORY_SEPARATOR', (isset($_ENV['OS']) ? (ereg('^Windows', $_ENV['OS']) ? '\\' : '/') : '/'));
245 /*------------------------------------------------------------------------------*/
246 /* The physical path to the document root */
247 /*------------------------------------------------------------------------------*/
249 if (extension_loaded('mbstring')){ // mbstring使用可能
250 $sRealPath = mb_convert_encoding( realpath( './' ), 'UTF-8', $fckphp_config['FileEncoding'] ) ;
\r
252 if (function_exists('mb_split')){
253 $sSelfPath_part = mb_split('/', dirname($_SERVER['PHP_SELF']));
255 $sSelfPath_part = explode('/', dirname($_SERVER['PHP_SELF']));
258 for ($n = 0; $n < count($sSelfPath_part); $n++)
259 $sSelfPath_part[$n] = mb_convert_encoding(rawurldecode($sSelfPath_part[$n]), 'UTF-8', $fckphp_config['FileEncoding']);
261 $sSelfPath = implode( DIRECTORY_SEPARATOR, $sSelfPath_part ) ;
\r
263 $fckphp_config['basedir'] = mb_substr( $sRealPath, 0, mb_strlen( $sRealPath ) - mb_strlen( $sSelfPath ) ) ;
265 $sRealPath = realpath('./');
267 //$sSelfPath_part = split( '/', dirname($_SERVER['PHP_SELF']) ) ;
268 $sSelfPath_part = explode('/', dirname($_SERVER['PHP_SELF']));
269 for ($n = 0; $n < count($sSelfPath_part); $n++){
270 $sSelfPath_part[$n] = rawurldecode($sSelfPath_part[$n]);
272 $sSelfPath = implode( DIRECTORY_SEPARATOR, $sSelfPath_part ) ;
274 $fckphp_config['basedir'] = substr($sRealPath, 0, strlen($sRealPath) - strlen($sSelfPath));
276 // document rootはMagic3から取得(add by naoki)
277 $fckphp_config['basedir'] = $gEnvManager->getDocumentRoot();
278 /*==============================================================================*/