Hi All,
I am the lead developer for JFusion and have been working on a visual integration of phpBB3 into Joomla itself. JFusion is a universal bridge software for Joomla that allow for user integration of many different softwares. The problem I am having is as follows:
phpBB3 specifically calls "exit" in /inlcludes/function.php file in the function exit_handler().However this causes all currently active code to be stopped including the Joomla code that is still running and trying to parse the phpBB3 output buffer. When I comment out the "exit" the phpBB3 output buffer is parsed successfully, but pages that require some sort of redirect (login, logout, posting, etc), have the page displayed in duplicate with the lower output having displaying extra SQL errors (see attached image).
It would be great if someone would point out to me where this additional page and error are generated. Or if someone could give me the username of one of the phpBB3 developers to PM.
Thanks, Marius
Outbuffering for integration with Joomla and errors
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Outbuffering for integration with Joomla and errors
- Attachments
-
- phpbb3_error.gif (37.51 KiB) Viewed 8474 times
Re: Outbuffering for integration with Joomla and errors
Add a hook for the exit_handler() to be able to continue your softwares operation.
Re: Outbuffering for integration with Joomla and errors
Thanks for the reply. Even when I change the exit statement to "return true;" (which is what essentially the hook would do). the problems still persist with the double pages and the SQL error. Therefore I don't think that adding an exit hook will help.
Anything else that I would be able to do?
Thanks, Marius
Anything else that I would be able to do?
Thanks, Marius
Re: Outbuffering for integration with Joomla and errors
Adding the hook only makes sure you are able to proceed processing data.mariusvr wrote:Thanks for the reply. Even when I change the exit statement to "return true;" (which is what essentially the hook would do). the problems still persist with the double pages and the SQL error. Therefore I don't think that adding an exit hook will help.
maybe quoting the SQL error?Anything else that I would be able to do?
Re: Outbuffering for integration with Joomla and errors
I have tried adding hooks and even trying out the same code that rokbridge uses, but with no success. phpBB3 still seems to stop any Joomla code at its exit hook.
Is there any code that I could try out to get these hooks up and running?
Thanks, Marius
Code: Select all
/* set scope for variables required later */
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $user, $auth, $template, $cache, $db, $config, $phpbb_hook;
global $action, $module, $mode, $starttime;
global $forum_id, $topic_id, $post_id, $user_id;
//loaded the Rokbridge hooks as a test
require_once(JPATH_ADMINISTRATOR .DS.'components'.DS.'com_jfusion'.DS.'plugins'.DS.'phpbb3'.DS.'hooks.php');
define('PHPBB_DB_NEW_LINK' , true);
define('PHPBB_EMBEDDED' , true);
define('PHPBB_MSG_HANDLER' , 'msg_handler_hook_register');
// Get the output
ob_start();
$rs = include_once($index_file);
$buffer = ob_get_contents();
ob_end_clean();
Thanks, Marius
Re: Outbuffering for integration with Joomla and errors
The problem you have is that there are many places where the code assumes that function to actually exit. So if the function returns it will continue with other code that was not supposed to be executed. So instead you need to execute all your code in that hook function (or call other functions you want to execute) and afterwards exit.
Re: Outbuffering for integration with Joomla and errors
Well that will be a problem, since JFusion runs completely within Joomla itself, which means there could be many tasks left inside Joomla to run. Whereas rokbridge is a script that runs completely outside Joomla and where it is easier to complete the buffer parsing in a hook.
Since there is no way to find out what else Joomla needs to run (different people run different modules), it won't be possible to run the remaining functions in a phpBB3 hook.
Is there a way where we can avoid an exit statement and still have a clean exit? The problem seems to occur in pages where there is a redirect (login,logout, post,etc). Would you be able to point me in the direction where the additional code is executed (that normally would be stopped with the exit statement). Maybe a return statement can be added at these locations which will stop the code cleanly and will allow for output buffers to work.
Thanks, Marius
Since there is no way to find out what else Joomla needs to run (different people run different modules), it won't be possible to run the remaining functions in a phpBB3 hook.
Is there a way where we can avoid an exit statement and still have a clean exit? The problem seems to occur in pages where there is a redirect (login,logout, post,etc). Would you be able to point me in the direction where the additional code is executed (that normally would be stopped with the exit statement). Maybe a return statement can be added at these locations which will stop the code cleanly and will allow for output buffers to work.
Thanks, Marius
Re: Outbuffering for integration with Joomla and errors
I doubt that's possible without major code changes in quite a few places.
Re: Outbuffering for integration with Joomla and errors
From what I understand it is not possible to catch a die or exit statement that is called from within an output buffer. When an exit statement is called all running code is stopped and all open output buffers flushed. Is there an other way to make it possible to get phpBB3 inside an output buffer?
It would be a pity if phpBB3 can not be made compatible with output buffers, as this is possible with the other major bb softwares (here is an SMF example embedded into Joomla with JFusion):
http://www.jfusion.org/index.php?option ... &jname=smf
It would be great if you know of a different way to get phpBB3 into an output buffer. I'll be happy to put in the time to get an alternative visual integration method up and running, as I believe phpBB3 is the best bb software available (we use it for our jfusion forums). However I might need a push in the right direction to overcome this problem.
Thanks, Marius
It would be a pity if phpBB3 can not be made compatible with output buffers, as this is possible with the other major bb softwares (here is an SMF example embedded into Joomla with JFusion):
http://www.jfusion.org/index.php?option ... &jname=smf
It would be great if you know of a different way to get phpBB3 into an output buffer. I'll be happy to put in the time to get an alternative visual integration method up and running, as I believe phpBB3 is the best bb software available (we use it for our jfusion forums). However I might need a push in the right direction to overcome this problem.
Thanks, Marius
Re: Outbuffering for integration with Joomla and errors
What about a terminate argument to the exit handler, which can be used by redirect(). Errors can be trapped by checking for the IN_ERROR_HANDLER constant.