Extraction of topics - conflicting functions

Discussion forum for MOD Writers regarding MOD Development.
Locked
apostolov
Registered User
Posts: 9
Joined: Sun Dec 16, 2007 11:28 pm

Extraction of topics - conflicting functions

Post by apostolov »

I am trying to write a block of code that will extract the latest topics from phpBB3. So far, so good. The problem comes that this code will be used within Joomla! (as a module there), but the idea is to rely on the phpBB3 API in order to process the ACL check for what should be displayed or not (if the user has access to read certain forum or not, the latest displayed topics could vary).

Therefore, the whole file is build on starting point:

Code: Select all

		define('IN_PHPBB', true);
		$phpEx = substr(strrchr(__FILE__, '.'), 1);
                include_once "".$phpbb_root_path."/config.php";
		include_once($phpbb_root_path . 'common.' . $phpEx);

// Important, this row limits the access
		$forums = array_unique(array_keys($auth->acl_getf('f_read', true))); 
However, this one works pretty fine as a stand-alone script (where the phpbb_root_path is already defined), but the major problem is that when it is executed by Joomla! two functions conflict and result in an error:

Code: Select all

Fatal error: Cannot redeclare utf8_strrpos() (previously declared in /var/www/web2129/web/libraries/phputf8/mbstring/core.php:49) in /var/www/web2129/web/distribution/includes/utf/utf_tools.php on line 122
Any hints, how this could be resolved would be appreciated.
geoffreak
Registered User
Posts: 591
Joined: Sat Feb 12, 2005 8:39 am
Contact:

Re: Extraction of topics - conflicting functions

Post by geoffreak »

Take out

Code: Select all

include_once "".$phpbb_root_path."/config.php";
unless this resolves a joomla conflict.
Change common to a normal include. I don't know why you used include_once there.

You will need to remove or rename the function in one of the two systems. Assuming they do the same thing, you should just be able to include the function from the one that doesn't have it.
Anime Revolution - Your new #1 source for All things anime and manga!
READ MY BLOG ALREADY!
apostolov
Registered User
Posts: 9
Joined: Sun Dec 16, 2007 11:28 pm

Re: Extraction of topics - conflicting functions

Post by apostolov »

Well, it solves the conflict, but in that way I am unable to access the phpBB3 database, which makes the whole idea senseless.
apostolov
Registered User
Posts: 9
Joined: Sun Dec 16, 2007 11:28 pm

Re: Extraction of topics - conflicting functions

Post by apostolov »

Actually the conflict comes from common.php
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: Extraction of topics - conflicting functions

Post by joeroberts »

there is no need to include config.php as it is called for in common.php
what if any error's do you get now?
apostolov
Registered User
Posts: 9
Joined: Sun Dec 16, 2007 11:28 pm

Re: Extraction of topics - conflicting functions

Post by apostolov »

No, excluding config.php doesn't solves the issue. The issue is solved, if the common.php is excluded. Of course if I do this, the remaining part of the code stops working, as it is tight to it.
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: Extraction of topics - conflicting functions

Post by joeroberts »

joeroberts wrote:there is no need to include config.php as it is called for in common.php
what if any error's do you get now?
what you well have to do is go threw alot of the phpBB3 functions and add

Code: Select all

if(!function_exists("the_function"))//replace the_function with conflicting functions
in front of each that cause the conflict this well allow phpBB3 to remain functional and allow you to use it in your adaption
Locked

Return to “[3.0.x] MOD Writers Discussion”