1

Topic: Using custom session object breaks FileManager?

Hi all,

I'm using a custom session object which saves the session in the database in stead of on the filesystem (PHP default). This gives me more control on how long a session can last, without being subject to the PHP garbage collection. So, before every session_start(), I'm including and instantiating this object. I've had to change the SessionAuthenticator.php file (and also login_session_auth.php and ExternalAuthenticator.php) to also include and instantiate the object, otherwise I was shown the default login page when I opened the filemanager. When I open the filemanager now, it only shows a blank page. Displaying of errors is on (error_reporting = E_ALL), but the page remains blank.

When I don't use the custom session object, the filemanager shows correctly.

Any help would be appreciated.

Note: I have the same problem with the imagemanager.

Last edited by TorinNL (2011-03-19 13:49:32)

2

Re: Using custom session object breaks FileManager?

Just add your custom session logic to config.php and it will be loaded before any sessions are handled. Also use require_once(dirname(__FILE__) . '/path/to/your/logic'); so that it loads it relative from config.php and not from the requesting page.

Best regards,
Spocke - Main developer of TinyMCE

3

Re: Using custom session object breaks FileManager?

Thanks for your response. I'm not quite sure what to do, though. I have the following code to use my session object:
require_once $_SERVER['DOCUMENT_ROOT'].'/library/mysession.php';
$obj_mysession = new MySession();
session_start();

What exactly should I then add to the config.php?

Additional note: when I try to open the file/imagemanager the popup 'hangs' on:
http://www.mysite.com/js/tinymce/jscripts/tiny_mce/plugins/imagemanager/index.php?type=im&page=index.html

TIA for any help.

4

Re: Using custom session object breaks FileManager?

So you don't provide a session manager replacement for the built in session logic in PHP? Then you need to do that or create your own plugin for the ImageManager that uses your session logic instead of the built in on in PHP. If it doesn't load it could be that it outputs contents from your files hard to tell from here without looking at your code.

Best regards,
Spocke - Main developer of TinyMCE

5

Re: Using custom session object breaks FileManager?

In the class constructor of my session object I've placed the following code:

// Register this object as the session handler
session_set_save_handler( 
    array( &$this, "sess_open" ), 
    array( &$this, "sess_close" ),
    array( &$this, "sess_read" ),
    array( &$this, "sess_write"),
    array( &$this, "sess_destroy"),
    array( &$this, "sess_gc" )
);

As far as I know this causes my object logic to replace the built in session logic in PHP and enables me to save the session data in a database.

I just don't get why the use of my own class causes the hangup on showing the files in the image/filemanager. When I add a print_r( $_SESSION ) in http://www.mysite.com/js/tinymce/jscrip … /index.php it shows the correct session variables.

6

Re: Using custom session object breaks FileManager?

If it contains any form of output it will break json-rpc calls. So if you have any output in your session file it will fail. Could also be some PHP errors that causes the problem can't be sure from here.

Best regards,
Spocke - Main developer of TinyMCE

7

Re: Using custom session object breaks FileManager?

Hmm, my session object does return some data, namely the data stored in the database for the specified session (which seems logical). It's too bad TinyMCE and my session object don't play nicely. I've now added a redirect to my login procedure to set the TinyMCE session information without using my session object. Not ideal, but it's working now. Thanks for trying to help.

8

Re: Using custom session object breaks FileManager?

Should work with custom session logic. Some of the CMS integrations we have uses that.

Best regards,
Spocke - Main developer of TinyMCE