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.