FCKeditorその2

FCKeditorのファイルマネージャperl版の改造。

  • editor/filemanager/browser/default/connectors/perl/connector.cgi

以下のように設定ファイルを読み込みそれが優先するようにした。

 #####
 #  FCKeditor - The text editor for internet
@@ -55,26 +55,38 @@
 require 'basexml.pl';
 require 'commands.pl';
 require 'upload_fck.pl';
+require 'config.pl';

-       if($FORM{'ServerPath'} ne "") {
-               $GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'};
-               if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) {
-                       $GLOBALS{'UserFilesPath'} .= '/' ;
-               }
+       if ($Config_UserFilesPath) {
+               $GLOBALS{'UserFilesPath'} = $Config_UserFilesPath;
        } else {
-               $GLOBALS{'UserFilesPath'} = '/UserFiles/';
+               if($FORM{'ServerPath'} ne "") {
+                       $GLOBALS{'UserFilesPath'} = $FORM{'ServerPath'};
+                       if(!($GLOBALS{'UserFilesPath'} =~ /\/$/)) {
+                               $GLOBALS{'UserFilesPath'} .= '/' ;
+                       }
+               } else {
+                       $GLOBALS{'UserFilesPath'} = '/UserFiles/';
+               }
        }

        # Map the "UserFiles" path to a local directory.
-       $rootpath = &GetRootPath();
-       $GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'};
+       if ($Config_UserFilesAbsolutePath) {
+               $GLOBALS{'UserFilesDirectory'} = $Config_UserFilesAbsolutePath;
+               if ($GLOBALS{'UserFilesDirectory'} !~ m|/$|) {
+                       $GLOBALS{'UserFilesDirectory'} .= '/';
+               }
+       } else {
+               $rootpath = &GetRootPath();
+               $GLOBALS{'UserFilesDirectory'} = $rootpath . $GLOBALS{'UserFilesPath'};
+       }

        &DoResponse();
  • editor/filemanager/browser/default/connectors/perl/config.pl

設定情報の記述用ファイルの追加

#####
#  FCKeditor - The text editor for internet
#  Copyright (C) 2003-2006 Frederico Caldeira Knabben
#
#  Licensed under the terms of the GNU Lesser General Public License:
#               http://www.opensource.org/licenses/lgpl-license.php
#
#  For further information visit:
#               http://www.fckeditor.net/
#
#  "Support Open Source software. What about a donation today?"
#
#  File Name: connector.cgi
#       This is the File Manager Connector configuration file for Perl.
#
#  File Authors:
#               Takashi Yamaguchi (jack@omakase.net)
#               Frederico Caldeira Knabben (fredck@fckeditor.net)
#####

$Config_UserFilesPath = '/~foo/UserFiles/';
$Config_UserFilesAbsolutePath = '/home/foo/public_html/UserFiles/';

1;