Refactor filebrowser to rid editorbrowser.php

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Refactor filebrowser to rid editorbrowser.php

Post by cmb » Thu Dec 11, 2014 12:52 am

Hello Community,

the standard filebrowser has two modes of operation, sometimes called "CMS browser" and "editor browser". The former is used for direct access via the admin menu (Files -> ...); the latter is used from the editor. The separation of both modes is conceptionally necessary, and there's nothing wrong with it. However, I dislike that the "editor browser" is accessed via a separate file (namely plugins/filebrowser/editorbrowser.php), what has lead to code duplication (see for instance Filebrowser_View::fileList() vs. ::fileListForEditor()) and also blows up the session (e.g. the complete localization is stored there).

I can't see any good reason for a separate editorbrowser.php. It should work perfectly fine to go through index.php as usual for the "editor browser" as well, and this way we could simplify the filebrowser's code and slim down the session. Therefore I propose to refactor the filebrowser for CMSimple_XH 1.7 respectively.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: Refactor filebrowser to rid editorbrowser.php

Post by manu » Thu Dec 11, 2014 4:20 pm

+1

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Refactor filebrowser to rid editorbrowser.php

Post by cmb » Wed Feb 25, 2015 10:35 pm

I'd like to suggest this patch. Note that the editorhooks for other editors than tinymce would still have to be patched, as well as the editor plugins themselves (cf. plugins/tinymce/init.php).

PS: Oops, nearly forgot to mention that the filebrowser defined $_SESSION['xh_session'] which is required by hi_updatecheck, and maybe other plugins. The patch removes this session variable. It might be reasonable to define it in the core (on login) for backward compatibility, but I'm not sure whether this is necessary, or a good idea at all.
Christoph M. Becker – Plugins for CMSimple_XH

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: Refactor filebrowser to rid editorbrowser.php

Post by Holger » Thu Feb 26, 2015 9:53 am

cmb wrote:PS: Oops, nearly forgot to mention that the filebrowser defined $_SESSION['xh_session'] which is required by hi_updatecheck, and maybe other plugins. The patch removes this session variable. It might be reasonable to define it in the core (on login) for backward compatibility, but I'm not sure whether this is necessary, or a good idea at all.
Thought $_SESSION['xh_session'] is defined by the core :shock: . It's still defined when another filebrowser is active because the core includes all installed plugins.
If you put "filebrowser" to the list of disabled plugins or deactivate it with hi_admin, $_SESSION['xh_session'] remains undefined.

So IMO it would be the best to get rid from $_SESSION['xh_session'].

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Refactor filebrowser to rid editorbrowser.php

Post by cmb » Thu Feb 26, 2015 12:25 pm

Holger wrote:Thought $_SESSION['xh_session'] is defined by the core :shock:.
No, it was a filebrowser thing from "the beginning" (r134). (Unfortunately, there are no older revisions regarding the Filebrowser in the SF repo , because the development of XH 1.5 happened mostly outside from it.)
Holger wrote:So IMO it would be the best to get rid from $_SESSION['xh_session'].
I would like to do that.
Christoph M. Becker – Plugins for CMSimple_XH

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: Refactor filebrowser to rid editorbrowser.php

Post by Holger » Thu Feb 26, 2015 1:12 pm

cmb wrote:I would like to do that.
+1

So maybe we could, as discussed by PM, rely on $_SESSION['xh_password'] instead...

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Refactor filebrowser to rid editorbrowser.php

Post by cmb » Thu Feb 26, 2015 1:52 pm

Holger wrote:So maybe we could, as discussed by PM, rely on $_SESSION['xh_password'] instead...
Well, both solutions have a flaw: they don't check whether the user is logged in to the right installation, but rather whether the user is logged in to any CMSimple_XH installation on the domain (see also my PM).
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Refactor filebrowser to rid editorbrowser.php

Post by cmb » Mon Mar 23, 2015 12:50 am

cmb wrote:Therefore I propose to refactor the filebrowser for CMSimple_XH 1.7 respectively.
Done (r1518).
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply