1
mboyden
FCKeditor on 2.0.x - with Image and Uploads - Instructions
  • 2007/4/30 20:20

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


Like many of you who posted on this site, you've struggled with implementing FCKeditor on your XOOPS 2.0.x installation. Here are the instructions and information to get it running for you. It includes the ability to upload images and other files allowed in FCKeditor sitewide as well as for specific modules if you want to have separate locations for separate modules. [Note: This uses the XOOPSeditor v1.10 download. I used this on 2.0.16, but I expect that it will work for most of the 2.0.x versions. Also, since I'm now on PHP5, there may still be some other code in there that doesn't work on PHP4, but I don't have PHP4 servers available for testing anymore, so your mileage may vary. But the one fix I proffer here is a PHP4 & 5 solution.]

If you have questions, post to this topic and I'll answer and clarify. I've also posted instructions formatted in HTML on my website. That may be more readable than what I can accomplish here.

If you want, instead of doing this editing, you may want to just download my update to FCKeditor.

HOW IT WORKS (DEVELOPER VIEWPOINT)
----------------------------------
In essense, this implementation will build a variable $uploadPath which is tacked onto the XOOPS_UPLOAD_URL which is the XOOPS_ROOT."/uploads" directory. So ALL of your files will be there (unless you do some additional hacking -- not recommended).

This implementation of FCKeditor will look for configuration files in the module directory and use those settings. If it doesn't find the files there, then it uses a default specification (XOOPS_ROOT/uploads/fckeditor unless you change per instructions below).

Under this FCKeditor upload directory, depending upon your usage, it will create the following subdirectories for uploaded content: Image, File, Flash, and Media (yes, case sensitive). You do NOT have to create these yourself, although you may run into permission issues that you may have to fix (more info below)

IMPLEMENTING FCKeditor
----------------------
In short, here are the steps to get FCKeditor (included in XOOPSEditor v1.10) working for your modules (in 2.0.x, where I was using 2.0.16):
- Download XOOPSeditor 1.10 and install per instructions - use the readme.txt file.
- At this point, FCKeditor is in this folder: XOOPSROOT/class/xoopseditor/FCKeditor (don't change this folder name due to some hard-coding)
- Modify any calls from your modules that aren't using this path to point to this location (I realize some specify fckeditor instead of FCKeditor, but due to hardcodings, you'll not want to change that).
At this point, the editor should generally work (except maybe for uploads).

ENABLING FCKeditor UPLOADS
--------------------------
To have uploads work (for images), you will have to edit these files (from FCKeditor folder) due to some error in coding (I couldn't figure out what was trying to be done but I got it to work right):
- /editor/filemanager/browser/default/connectors/php/config.php
- /editor/filemanager/upload/php/config.php
What you want to do is modify two lines:
$fckeditor_root_path = substr($current_path, 0, stripos($current_path, basename(dirname(dirname(__FILE__)))."/editor"));
to be:
$fckeditor_root_path = dirname(substr($current_path, 0, strrpos($current_path, "/editor")));
and (in case you want your upload path to use subdirectories and not strip out the slashes)
if(!defined("XOOPS_FCK_FOLDER") || !$uploadPath = preg_replace("/[^a-z0-9_\-]/i", "", XOOPS_FCK_FOLDER) )
to be:
if(!defined("XOOPS_FCK_FOLDER") || !$uploadPath = preg_replace("/[^a-z0-9_\-\/]/i", "", XOOPS_FCK_FOLDER) )
- if you want, edit the $uploadPath variable (about line 50) in both config.php files as well for the default path (default is fckeditor).

UPLOAD FILE PERMISSIONS
- files are created with 777 permissions unless you change line 206 of editor/filemanager/browser/default/connectors/php/commands.php and line 109 of editor/upload/upload.php to the permissions you want
- folders are created with 777 permissions unless you change line 73 of editor/filemanager/browser/default/connectors/php/io.php to the permissions you want

Notes:
I disabled the Upload tab on the main Image/Flash insert window because these files uploaded into the uploadPath directory and thus weren't browsable later using the Browse Server button on the Image Info, Flash Info or Link tabs. I did this in the editor/filemanager/upload/php/config.php file, line 47, setting $Config['Enabled'] = false;. I was still able to upload using the Browse Server button pop-up. Until we can see the files with the browser, it doesn't make sense to use this upload tab.

I also wanted to use server relative URLs because I make a basic server setup that I replicate to many sites, so then I had to make changes again....
I changed line 55 of editor/filemanager/browser/default/connectors/php/config.php and line 51 of editor\filemanager\upload\php\config.php from:
$Config['UserFilesPath'] = XOOPS_UPLOAD_URL."/".$uploadPath."/" ;
to:
$Config['UserFilesPath'] = str_replace(XOOPS_URL,"",XOOPS_UPLOAD_URL)."/".$uploadPath."/" ;
This just removes the portion with your server name. Relative URLs rule for content!

MODULE SPECIFIC UPLOAD DIRECTORIES
Finally, if you want to enable module specific versions of this, then for each module that you want to have different from the global settings, here is what you do:
- copy the files from the FCKeditor/modules folder to the directory of the module in which you want an upload area named by module.
- edit MODULE/fckeditor.upload.php and ENABLE uploads (if you want), by disabling the FCKUPLOAD_DISABLED variable: define("FCKUPLOAD_DISABLED", 0);
- Note: If you are troubleshooting and make any changes, you will want to clear a cached file in the cache directory for each module, named XOOPS_ROOT/cache/fckeditor.MODULE_NAME.js to have the changes take effect.

Clear as mud? Hope so. But if you still are having problems, then you can use the two test files included to help troubleshoot your installation just like I did:
http://yoursite.com/class/xoopseditor/FCKeditor/editor/filemanager/browser/default/connectors/test.html and
http://yoursite.com/class/xoopseditor/FCKeditor/editor/filemanager/upload/test.html

Things I would like to see:
- Toolbars. I'd like to offer Users just the basic toolbar and then offer other groups (Admins and privileged content contributors) the ability to use the full toolbar. I see this in the implementation for Drupal, so I'm sure it can be done here. That's left for another day for me. I assume that even though the toolbar isn't there, I can still upload just about any HTML, though, so I'm not sure if it buys any security for the site.
- Options moved to config file. Many of these changes can likely be moved to the configuration file(s). This includes permissions, paths, etc. I expect that is where one would likely want to add the module info, too.

Many thanks to the following posts for helping me to get this going:
XOOPS: Post 1 | Post 2 | Post 3;
XOOPSInfo Post
which also pointed to this XOOPSforge thread which also pointed me to the test URLs. From all of these pointers, I was able to figure it out. Hope it helps you!
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

2
seawolf
Re: FCKeditor on 2.0.x - with Image and Uploads - Instructions
  • 2007/5/1 22:28

  • seawolf

  • Just popping in

  • Posts: 12

  • Since: 2007/3/19


I've tryied your new version of FCKeditor for xoopseditor that should work on 2.0.16 with the module "articles" version 1.03 without sucess.

I can see the editor but I canĀ“t write, it does't allow me and show's me an error on IE6-sp2.

On 2.2.4 all works well width the default xoopseditor.

Armando

3
mboyden
Re: FCKeditor on 2.0.x - with Image and Uploads - Instructions
  • 2007/5/1 23:32

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


Hmmmmm. No quick answer yet. When you say it won't write, does that mean that you can't input text, or that you can't write (upload) files? Just want to make sure I'm clear on it.

I was able to use the editor without image uploads on a default installation prior to all of the changes I went through. If you install the XOOPSeditor v1.10 on 2.0.16 without my FCKeditor implementation, can you use the editor then and just write text and save it? You do need to install XOOPSeditor first before implementing this FCKeditor installation on top of the existing one in XOOPSeditor.

Since the editor loads, I assume that articles is pointing to the correct folder. I'm about to implement Articles on my dev site, so I'll see if I can figure out why it does or doesn't work and report back then.

Also, what file permissions do you need for writing files using XOOPS? I just looked at what I uploaded and it's set to 755 for directories and 644 for files which is what a suphp-based site needs, which is what I run for added security reasons (among others). I meant to set those to 777 before I uploaded it. If you change those in the code, does that fix the upload issue?
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

4
mboyden
Re: FCKeditor on 2.0.x - with Image and Uploads - Instructions
  • 2007/5/3 20:18

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


Okay, I finally installed Articles 1.03 (which isn't an update to Article 1.0 for whatever reason). To get FCKeditor (and the other editors) working, you will have to specify the correct directory in the preferences. In this case it is /class/xoopseditor/FCKeditor . I was able to set mine up and get the images stuff to work fine and all. I now have it running and working just fine for SmartSection 2.13, Articles 1.03, and CBB 3.08.

BTW, I have updated the download on my site because I had changed the file/directory permissions to what I use (755/644) and I found an error in the FCKeditor that changed the ampersands of HTML codes causing broken code. The newest update (-MPB2) fixes both of these. I reported these issues to the XOOPSeditor project in their bugs section.

If you still have problems, use the two test URLs that I highlighted in the article and tell me what error messages you get. You might PM me directly so we can address this some over e-mail and then post a solution here.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

5
desperados
Re: FCKeditor on 2.0.x - with Image and Uploads - Instructions

i've downloaded and copied editor_1-10-fckeditor-mpb2.tgz but images upload doesn't work

6
mboyden
Re: FCKeditor on 2.0.x - with Image and Uploads - Instructions
  • 2007/5/6 15:54

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


I'd be happy to try and help solve the issue if you can tell me more than just "it doesn't work". I've only modified a couple of files and only minimally so.

I posted some information about how you can work through this and the test files that you can try. Did you try the test files? What output did you get?

Where did you load the FCKeditor? It sounds like FCKeditor is loading for you, but images isn't working. Try the test files as I put in my posting and report the messages you get. It's how I found the main problems in the first place.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

7
desperados
Re: FCKeditor on 2.0.x - with Image and Uploads - Instructions

first, thanks you for your help.

the editors works well, but when i want to insert/upload image, and open the popup, nothing happens! it says: "uploading...". how can i make some debug?

8
mboyden
Re: FCKeditor on 2.0.x - with Image and Uploads - Instructions
  • 2007/5/9 13:21

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


First, which pop-up. There are two. The first pop-up happens when you try to insert an image (or file). The second when you push the Browse Server button in the first pop-up. The Browse Server area is the "magic" IMHO. This is where you can browse your images (and other files) and upload them. The main upload button in the first pop-up doesn't use the subdirectories (Image, File, etc.), so I find it useless and actually disabled it in my installation, but left it turned on in my download in case someone wanted it for some reason.

As I mentioned in the original post and a couple of others, there are two test files available with FCKeditor that should help figure out what the problems are. One is for the browser side of things (when you push the Browse Server button) and the other is for file uploads. Check both of those files and see what you get.

If you aren't getting XML code in the box when you try getting it to work, then something is wrong with your implementation. I had to insert code to print out variables on that page to figure out what was happening, and then got it going.

I'd be interested to hear what you get so I can make this work for more people. I have gotten so much good help from this community, that I've been trying to give back more, too.

The XOOPSeditor framework seems to generally be oriented towards the 2.2.x branch of XOOPS, but the idea I've been pushing is to make it work for 2.0.x. This along with profiles are two major issues holding XOOPS "back" in it's struggle against the other two CMSes that gain more attention (Joomla and Drupal). I'm getting more and more requests to use these latter two, and Drupal is a memory hog and neither has a good caching system to help make it lighter weight on the system for shared hosting. And CiviCRM works with both those, and I'm getting a lot of requests for that as well.

Let me know....
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

9
mboyden
Re: FCKeditor on 2.0.x - with Image and Uploads - Instructions
  • 2007/5/18 15:10

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


I wanted to note that one site running PHP 4.4.4 had some problems with the code that I had used. The problem was that the strrpos() function was actually returning errant results. I'm not sure why, but it must be a bug somewhere there. If that's the case, and if you don't have "/editor" anywhere else in your path(s) where FCKeditor is used, then you can modify the two config.php files to replace strrpos with the strpos function:

Thus:

$fckeditor_root_path = dirname(substr($current_path, 0, strrpos($current_path, "/editor")));

becomes:

$fckeditor_root_path = dirname(substr($current_path, 0, strpos($current_path, "/editor")));

Secondly, the version I published uses server-relative URLs, so if you install XOOPS in a subdirectory off your root, then you may need to edit the line related to URLs or take it back to full URLs. I still think relative URLs rule, but your setup and mileage may vary.

Clear as mud? Hope so. Again, if you have problems, I want to hear them and I'll help fix them.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

10
trspice
Re: FCKeditor on 2.0.x - with Image and Uploads - Instructions
  • 2007/5/19 4:00

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


With the Xoopseditor 1.10 installed, is the DHTML editor for the Add new blocks in admin supposed to be gone? If yes how do I enable FCKeditor for the Add new blocks?

Using X2.0.16
Xoopseditor 1.10
Frameworks
There's nothing but science....
The Reggae Album

Login

Who's Online

365 user(s) are online (228 user(s) are browsing Support Forums)


Members: 0


Guests: 365


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits