KCFinder with NIGINX

I’m new to phpList. The arts festival for which I run the I/T are investigating MailChimp alternatives - I’m trying out 3.6.7 on my home server (Debian).

Everything seems fine apart from KCFinder. This pops up an empty window. Chrome developer tools shows jquery errors (see below).

I note that KCFinder is no longer supported but assume that since it’s still bundled, it is expected to work. I wonder if this is a nginx/Apache compatibility issue? Grateful for feedback.

John Glasson

ON CLICKING ANY BUTTON
Failed to launch ‘kcact:upload’ because the scheme does not have a registered handler.

ON OPENING
Uncaught TypeError: Cannot set properties of undefined (setting ‘checked’)
at Object..initSettings (index.php:2918:77)
at Object.
.init (index.php:2319:7)
at HTMLDocument. (browse.php?opener=ckeditor&type=image&cms=phplist&CKEditor=message&CKEditorFuncNum=1&langCode=en-gb:33:30)
at j (index.php:2:27136)
at Object.fireWith [as resolveWith] (index.php:2:27949)
at Function.ready (index.php:2:29783)
at HTMLDocument.K (index.php:2:30128)

@johng It works fine using Chromium or Firefox for me. Can you look in developer tools to see whether there is a set of seven cookies KCFINDER_order, KCFINDER_showname, etc.

No such cookies. I see request cookies from browse.php: browsetrail and phpListSession but no response cookies.

The request url from CKEditor is:

http://192.168.77.23:5558/admin/plugins/CKEditorPlugin/kcfinder/browse.php?opener=ckeditor&type=image&cms=phplist&CKEditor=message&CKEditorFuncNum=1&langCode=en-gb

@johng From what I can see those cookies should be created when as a result of clicking the “Browse server” button. But maybe your error is stopping that.

image

Clicking on the button doesn’t show any activity in the phpList tools window. But the new KCFinder window opens with the jscript errors that I mentioned. It seems logical that phpList->admin should generate cookies to pass to KCFinder - I wonder what’s supposed to trigger this?

Looks like the cookies should be set by phpList/lists/admin/plugins/CKEditorPlugin/kcfinder/js/030.jquery.helper.js
at line 282: return (document.cookie = str) ? true : false;

Seems to be happening ok. But I don’t see the cookies in Chrome developer tools.

@johng Can you try a different browser? How did you install phplist, anything unusual?

OK. I can repeat your problem by running my web server on a non-standard port, I used your value of 5558, and accessing through an IP address instead of a name. Both Firefox and Chromium have the problem.

It is fine if I use a non-standard port with a server name, or the standard port of 80 with an IP address.
No idea whether this is a problem with kcfinder or just common browser behaviour.

@johng I figured out that the problem is caused by the combination of an IP address and a port. Looking at the kcfinder github repository, that was raised as an issue several years ago. kcfinder dont work with ip4 address · Issue #115 · sunhater/kcfinder · GitHub

I’ll read through the related issues to see whether there is a sensible solution.

@johng I have made a change to the plugin to handle the case of accessing phplist using an IP address and port number. You can upgrade it on the Manage Plugins page using the package URL

https://github.com/bramley/phplist-plugin-ckeditor/archive/master.zip

Duncan I’ve now tried your revised version of CKEditor.

Initially I Got error:
Undefined variable: ip in /mnt/nvme/PHP/phpList/lists/admin/plugins/CKEditorPlugin/kcfinder/core/class/uploader.php on line 153

So I’ve re-instated (from the old version)

$ip = ‘(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)’;

I think all is now well.

Very many thanks for your help over this. Are you one of the authors of KCfinder? You’re clearly very familiar with the code.

@johng Sorry for that. It was due to working on a different copy to the one that I released. Now should be ok if you want to upgrade the plugin.

But the old version should have had the original problem if you are still using an IP address and a port.

I added the line $ip = ‘(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)’; into the new version.

I think that’s what you’ve done too? Anyway, it works fine.

Thanks again, especially for your detective work with different ip address formats.