Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2009-08-06 09:51:39

X*
New member
Registered: 2009-08-03
Posts: 5

EFM: backend data not passed, config ignored, default config used

Using ExtendedFileManager plugin, I couldn't make my personal configuration (good old IMConfig array) affect the EFM's behavior: I was using default config instead, loaded through xinha/plugins/ExtendedFileManager/config.inc.php. In xinha/contrib/php-xinha.php, function xinha_pass_to_php_backend was working well, but function xinha_read_passed_data was returning a NULL value.

In fact, you don't see any error, but the only symptomatic thing is that your configuration options are ignored, e.g. the plugin will use the default 'demo_images' location.

I saw several messages about it, and I encourage you to search for these, not only inside Xinha's forum and ticket system, but all over the Net. However, in my case, none of the posts I've seen so far gave me THE solution.

So, try this trick:

1. Go to xinha/contrib/php-xinha.php, in function xinha_read_passed_data.

2. Delete the '@' symbol before the call to session_start(). The '@' symbol forces no error to be reported, so deleting it would allow Warnings, Notices, etc. to be displayed. Naturally, you shouldn't leave any constraint concerning PHP's error reports for this test:

error_reporting(E_ALL);
//@session_start();  //'@'==error_reporting(0)
session_start();

3. Now try to get a picture in a Xinha editor (i.e. use the plugin!), and look for any PHP error message (don't forget to look into the HTML source code too if nothing's written on the display). In my case, the call to session_start created an error like "Warning: session_start(): open(xxx) failed: no such file or directory". You could otherwise have an error about privileges not granted to the script for writing in sessions' directory. If no error shows up, this post is unfortunately not for you. If session's already started, refer to the right call to session_start, or better, write a test code where session starts here. If session can't be started ("headers already sent by"), look for unwanted data sent (it can be just a blank space, anyway PHP is your friend: it gives you the file and line where data begin to be sent)

4. If above point generated a no-such-file-or-dir error, use your best PHP skills to to change your sessions' directory: either function session_save_path (like error_reporting, this function changes path for the current script), or through a .htaccess file (php_value session.save_path, changes path for file in the .htaccess' directory), or even directly in php.ini (session.save_path, changes path for any PHP file processed by this PHP module). The first option (function session_save_path) can override the second parameter (.htaccess), and both can override the third (php.ini), but I'm not to sweat learning you what php.net gives you wink
Otherwise, if above point launched a no-privilege error, use your best FileZilla skills to change privileges upon your sessions' directory (well THIS is NOT a problem).

To illustrate this with my own experience, my sessions' save path was defined as "./tmp". You can see that it's a relative address, therefore I had two solutions: create a directory named 'tmp' in xinha/contrib (bad idea), or redirect the session to my usual directory before starting it (better idea). Which gives the following xinha_read_passed_data function:

function xinha_read_passed_data()
  {
   if(isset($_REQUEST['backend_data']) && is_array($_REQUEST['backend_data']))
   {
     $bk = $_REQUEST['backend_data'];
     session_name($bk['session_name']);
     session_save_path($_SERVER['DOCUMENT_ROOT'] . '/administratif/tmp');    //added
     session_start();
     if(!isset($_SESSION[$bk['key_location']])) return NULL;
...

You see on the last edited line above that your backend data was considered NULL because PHP couldn't get the $_SESSION array, because of session bad start.

Finally, don't forget to rewrite the '@' symbol (no I won't look for an English translation of a word I never use orally!) after your test and before unleashing your brand new working Xinha!

Yes you can laugh, relative paths for sessions' path shall trigger your wrath. Guess what? I feel so path...etic tongue

Have fun!

Offline

#2 2009-08-06 10:12:46

X*
New member
Registered: 2009-08-03
Posts: 5

Re: EFM: backend data not passed, config ignored, default config used

Sorry, I forgot my references for this test: Xinha 0.96 beta 2, Apache 1.3.34 based on FreeBSD, PHP 4.4.2

Have fun! Funnier than that!

Offline

Board footer

Powered by FluxBB