1

Topic: Integrating PunBB into a generic CMS

I am currently writing an extension that will let me integrate PunBB to a content management system I use - basically, I want to use _my_ table of users, not PunBB's. Most of the stuff is easily done using hooks, but there are several changes that need to be done to the PunBB itself:

1) Database abstraction layer classes need to have a more detailed query_build parameters. Specifically, it is important to be able to use different prefixes for different tables, even within the same SELECT. As of now, there is only choice between all prefixes or no prefixes. I propose a change from:

if (isset($query['SELECT']))
{
    $sql = 'SELECT '.$query['SELECT'].' FROM '.((isset($query['PARAMS']['NO_PREFIX'])||(isset($query['PARAMS']['FROM_NO_PREFIX'])) ? '' : $this->prefix).$query['FROM'];

    if (isset($query['JOINS']))
    {
        foreach ($query['JOINS'] as $cur_join)
            $sql .= ' '.key($cur_join).' '.((isset($query['PARAMS']['NO_PREFIX'])||isset($cur_join['PARAMS']['NO_PREFIX'])) ? '' : $this->prefix).current($cur_join).' ON '.$cur_join['ON'];
    }

to

if (isset($query['SELECT']))
{
    $sql = 'SELECT '.$query['SELECT'].' FROM '.(isset($query['PARAMS']['NO_PREFIX']) ? '' : $this->prefix).$query['FROM'];

    if (isset($query['JOINS']))
    {
        foreach ($query['JOINS'] as $cur_join)
            $sql .= ' '.key($cur_join).' '.(isset($query['PARAMS']['NO_PREFIX']) ? '' : $this->prefix).current($cur_join).' ON '.$cur_join['ON'];
    }

2) User authentication functions in include/functions.php need a lot more hooks than they have now. The following parts should be optional, based on a hook response:
- Cookie expiration
- Cookie hash validation
E.g. something like:

$check_expiration = TRUE;
$validate_expiration_hash = TRUE;
($hook = get_hook('fn_cookie_login_validations')) ? eval($hook) : null;
if ($check_expiration) ...

I will post more if (when) I find them.

2

Re: Integrating PunBB into a generic CMS

OK, my merging of PunBB 1.3 with a generic CMS is almost complete. It turns out the two changes above are the only ones that need to be done - other than that, everything can be handled with hooks.

I'll need to do some more testing (at the moment it seems everything is working fine, but of course the users will surely find some missing brackets or semicolons). After that, I will see about releasing the extension; of course it will be useless on its own, but it should be reasonably simple to adapt it to your particular CMS.

3

Re: Integrating PunBB into a generic CMS

Hi!

I am very interested in this, would it be possible to get the extension now? (or perhaps a beta release? wink )

Best regards,

4

Re: Integrating PunBB into a generic CMS

Don't expect an easy and effortless plugin - you will have to do a lot of work. The point is that you no longer need to search the whole source code to find the places that need to be changed.

Download it here: http://www.pepak.net/tmp/studna_punbb.zip

I provided a short readme file with details on what needs to be done. I would definitely suggest trying it out on your local copy of your site first, and do consider it an alpha code - I am sure I missed a parenthesis or a semicolon here and there... The important parts of the forum seem to work, though.

If you find any errors or improvements, I would appreciate hearing about them.

(The extension is called "Studna" because it is intended for our horror-movie site Studna.)

Re: Integrating PunBB into a generic CMS

pepak wrote:

Don't expect an easy and effortless plugin - you will have to do a lot of work. The point is that you no longer need to search the whole source code to find the places that need to be changed.

Download it here: http://www.pepak.net/tmp/studna_punbb.zip

I provided a short readme file with details on what needs to be done. I would definitely suggest trying it out on your local copy of your site first, and do consider it an alpha code - I am sure I missed a parenthesis or a semicolon here and there... The important parts of the forum seem to work, though.

If you find any errors or improvements, I would appreciate hearing about them.

(The extension is called "Studna" because it is intended for our horror-movie site Studna.)

Sorry to be bumping an older thread, but I found this thread and was wondering if pepak would be so kind as to re-upload his example plugin studna_punbb.zip

The url is a 404 now smile

6

Re: Integrating PunBB into a generic CMS

Hmm, looks like the readme file is gone. Will have to rewrite it sometime.

Meanwhile, the extension is here: http://www.pepak.net/files/punbb-studna.zip

Basically, what needs to be done:
1) The extension should be unpacked in your <b>extensions</b> directory
2) Files in <b>modified</b> should replace original PunBB files. The changes are minimal (just compare the files) but need to be done.
3) Queries and URLs in <b>manifest.xml</b> need to be rewritten for your users-table and your URLs. Our engine is based on a really prehistoric PHP-Nuke. The whole point of this extension is that it isolates all references to user tables so that they can be modified easily.
4) Update your users table to contain all PunBB fields that are not present in your current table.
5) <b>all_users_fields</b> contain a fieldset part of a SELECT statement that returns all fields in users-table. You will notice that for the most part, it is just "my field renamed to PunBB field", with a few special cases (e.g. PHP-Nuke used a really stupid user_regdate format).
6) <b>users_fields_translate.php</b> contain a translation layer between PunBB fieldnames and your users-table's fieldnames.

7

Re: Integrating PunBB into a generic CMS

URL changed to:
http://www.pepak.net/files/punbb/studna.zip

This one should be permanent.