How to write a bridge file? How to write a bridge file?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

How to write a bridge file?

Started by THEMike, June 30, 2005, 05:34:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

THEMike

Hi,

I am a core developer on the geeklog project.

I am attempting to write a bridge file for geeklog. This should be pretty straightforward.

Is there any documentation on what functions a bridge file must provide and what they must return? For example, the udb_authenticate in the phpbb integration is quite a large function and appears to be setting up various info in an array. Rather than reverse engineer the array from this example bridge, I'd like to read the spec for what I should put in the array.

And so on...

Nibbler

Reverse engineering is pretty much your only option, as there are no docs on bridge file coding. Note that there is a new bridging system in CPG 1.4 which should be easier to work with so you may like to wait for that or check it out from CVS.

THEMike

How far off is 1.4 in the scheme of things? Are we talking "When it's ready" or is it getting close enough to say a month or two?

Joachim Müller

I'm currently in the process of packaging a public beta, but it should be pretty stable already. If you know what you're doing (and I guess you do ;)), I'd say it's save to go for cpg1.4.x

THEMike

ok which module name should I grab? It's a bit confusing...

Nibbler


THEMike

Ok got it, I wasn't sure as there was stable, and mention of beta's was made. Plus NG (Next Generation?) or just cpg...

Perhaps that should be noted somewhere easy to find on the site?

Questions:

1) // Table field names

Some of the fields we don't track in the simple tables. For example, last login, in geeklog is not stored in the user table but in a seperate table. Ditto the location and other profile info. The user table strictly controls access. Groups are also not held in the user table, this is stored in gl_group_assignments as it's a many to many relationship. The $this->field array doesn't appear to allow me to handle these issues. How can I deal with it?

2) session_extraction

What do I have to return here? The examples seem inconsistent. What should the keys in the array be? Can I return multiple groups?

Nibbler

If fields are not there, just enter "''" - a pair of single quotes in double quotes, then the query goes to SELECT '' as location for example.

For session_extraction return there shouldn't be specified keys as the values are extracted from the array using list(), the values are just the userid and password, which doesn't make much sense really but such is life. It's an optional function.

See also - http://forum.coppermine-gallery.net/index.php?topic=18395.msg87266#msg87266

THEMike

Right, after a slight delay due to children, dogs and other chaos in my life...

I have a "working" CPG 1.4.1 beta -> Geeklog 1.3.12CVS bridge file. It should work with geeklog 1.3.11 also, but I have only tested it on my CVS test instance. However, in the admin "Groups" section, I get four Coppermine user groups, not my geeklog user groups.

Care to suggest why this is?

Nibbler

To use imported groups you need to enable and support post based groups.

THEMike

OK, when I return groups for a user, should I add 100 to them? Or does the rest of the code apply the offset? Or am I barking up the wrong tree...

Currently, guest user causes this error:

While executing query "SELECT aid FROM cpg140_albums WHERE visibility != '0' AND visibility !='10000' AND visibility NOT IN " on 0

mySQL error: You have an error in your SQL syntax near '' at line 1

What is the stuff that should be after IN? Where should I be looking to find what I'm not setting right?

Nibbler

The set of groups the user is in should be inside the IN().

THEMike

I Was missing:


$user_group_set = '(' . implode(',', $USER_DATA['groups']) . ')';

THEMike

attached is a fully working bridge.

Joachim Müller


THEMike

Can you mark multiple groups as admin groups?

I don't have access to the code from here, unfortunately, but I think if I remember correctly, there is a single value for "the admin group" set up in the init function of the bridge class.

I'm tweaking my Bridge in light of some plugin integration work, so that I can mark specific geeklog user groups as having the "coppermine.admin" permission. The Root user group always has all permissions, but I want to grant gallery admin rights to specific other groups. Likewise, I want to grant "coppermine.use" permission to multiple groups of people who have non-admin access to the coppermine gallery (and then use Coppermine admin to say which galleries and what functions those multiple groups have).

The later (user access) is no problem, but I think that I'm limited to one group for admin, which would mean that if I wanted to grant a user access to the gallery admin, I would have to grant them root access to the entire of geeklog.

I've also got a custom theme nearly done that embeds the Gallery within the Geeklog UI. Just need to tidy up one or two details and I can release that.

Nibbler

Admin groups are set as an array, put as many as you like.