forum.coppermine-gallery.net

Dev Board => cpg1.4 Testing/Bugs => cpg1.4 Testing/Bugs: FIXED/CLOSED => Topic started by: Casper on May 02, 2005, 11:26:12 pm

Title: phpbb bridging not working, fresh install
Post by: Casper on May 02, 2005, 11:26:12 pm
I had problems adding a phpbb bridge, using phpbb 2.0.11 and the current dev checkout.

It caused database error.  So I installed the latest 2.0.14 version of phpbb, and on another up to date 1.4 cpg install, had exactly the same problem.

The db error is as follows;

Quote
While executing query "SELECT user_id as user_id FROM `clive_cpg`.phpbb_users WHERE group_id in (1)" on 0

mySQL error: Unknown column 'group_id' in 'where clause'

On checking, I found there is no such thing as 'group_id' in the phpbb users table, the nearest thing is 'user_level'.  I tried various changes to the phpbb.inc.php, all without success, as it's a bit above me.
Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 03, 2005, 09:01:15 pm
Caused by this code in init.inc.php

Code: [Select]
// Retrieve Array of Admin Users (used for hiding admin usernames on thumbnails)
$results = cpg_db_query("SELECT {$cpg_udb->field['user_id']} as user_id FROM $cpg_udb->usertable WHERE {$cpg_udb->field['usertbl_group_id']} in (" . implode(',',$CONFIG['ADMIN_GROUPS']).')');
$CONFIG['ADMIN_USERS']=array();
while ($row = mysql_fetch_array($results)) {
    $CONFIG['ADMIN_USERS'][] = $row['user_id'];
} // while
mysql_free_result($results);


You can't assume that all forums have such a simple user-group relationship, in fact most do not. I propose we cut this feature, and schedule it for 1.5 where it can be properly implemented. (unless someone has the time to find and test a solution for all 13 bbs).
Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 07, 2005, 12:58:17 pm
Taking that silence as agreement, feature removed.
Title: Re: phpbb bridging not working, fresh install
Post by: Casper on May 07, 2005, 04:02:36 pm
Just did an update, but still get the same error as originally posted;

Quote
While executing query "SELECT user_id as user_id FROM `clive_cpg`.phpbb_users WHERE group_id in (1)" on 0

mySQL error: Unknown column 'group_id' in 'where clause'
Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 07, 2005, 04:07:22 pm
Try rev 1.92
Title: Re: phpbb bridging not working, fresh install
Post by: Casper on May 08, 2005, 12:35:49 pm
Version 1.92 does not give an error, but admin is seen as a regular user, and gets the admin menus as a registered user, not admin, so cannot admin the gallery.
Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 08, 2005, 09:29:50 pm
Unrelated issue. Marking this as fixed. Will commit fixed up phpbb bridge for this new issue shortly.
Title: Nibbler, Why did you remove the display_admin_uploader feature?
Post by: donnoman on May 08, 2005, 09:50:00 pm
That was an approved 1.4 feature.

  • switch to show/hide admin username under thumbnails - see http://forum.coppermine-gallery.net/viewtopic.php?p=20779#20779  - done 2005-01-30 Donnoman

It should not have been removed without discussion.
Title: Re: Nibbler, Why did you remove the display_admin_uploader feature?
Post by: Nibbler on May 08, 2005, 09:54:44 pm
There was discussion - http://forum.coppermine-gallery.net/index.php?topic=17541
Title: Re: phpbb bridging not working, fresh install
Post by: donnoman on May 08, 2005, 09:59:14 pm
Sorry Nibbler, I missed this section as I do not use phpbb bridging so I never read this thread.

However you nixed a feature that I like for the sake of a single bridge that isn't working, I don't think thats a valid reason.

Fix either the bridging or the feature, I don't think nixing it is an acceptable solution.
Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 08, 2005, 10:09:42 pm
The code you added breaks many of the bridges in order to add a trivial feature. I only commented out the code, it is still there if you can fix the bug.
Title: Re: phpbb bridging not working, fresh install
Post by: donnoman on May 08, 2005, 10:11:04 pm
I don't understand where casper was having a problem with the original code.

Code: [Select]
// Retrieve Array of Admin Groups (used for hiding admin usernames on thumbnails)
$results = cpg_db_query("SELECT group_id FROM {$CONFIG['TABLE_USERGROUPS']} WHERE has_admin_access ");
$CONFIG['ADMIN_GROUPS']=array();
while ($row = mysql_fetch_array($results)) {
    $CONFIG['ADMIN_GROUPS'][]= $row['group_id'];
} // while
mysql_free_result($results);

// Retrieve Array of Admin Users (used for hiding admin usernames on thumbnails)
$results = cpg_db_query("SELECT {$cpg_udb->field['user_id']} as user_id FROM $cpg_udb->usertable WHERE {$cpg_udb->field['usertbl_group_id']} in (" . implode(',',$CONFIG['ADMIN_GROUPS']).')');
$CONFIG['ADMIN_USERS']=array();
while ($row = mysql_fetch_array($results)) {
    $CONFIG['ADMIN_USERS'][] = $row['user_id'];
} // while
mysql_free_result($results);
Just did an update, but still get the same error as originally posted;

Quote
While executing query "SELECT user_id as user_id FROM `clive_cpg`.phpbb_users WHERE group_id in (1)" on 0

mySQL error: Unknown column 'group_id' in 'where clause'

Which means theres an admin group with id of 1 set as administrators, but no users in the group... so how can any bridged user ADMIN his coppermine install?

He then reports:

Version 1.92 does not give an error, but admin is seen as a regular user, and gets the admin menus as a registered user, not admin, so cannot admin the gallery.

So this leads me to believe that if you correct the admin issue with the bridge, the original code for the admin uploader feature will work as designed.
Title: Re: phpbb bridging not working, fresh install
Post by: donnoman on May 08, 2005, 10:16:45 pm
Nibbler what was the "unrelated" issue?

Casper can you re-enable all the oringinal admin uploader code and see if it works properly now that you have the admin problem fixed.
Title: Re: phpbb bridging not working, fresh install
Post by: Casper on May 08, 2005, 10:23:11 pm
The admin problem is not fixed yet, so going back at the moment will just return me to the opening point of this thread.

I'm waiting for Nibblers fix to the phpbb.inc.php file.

Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 08, 2005, 10:24:28 pm
It's how the tables are setup in the database of the forum.

Your query assumes the user table stores the group of the user. Coppermine does this, so the query works.

PHPBB and others use a usergroups table, so you have to join the 2 tables on user_id to get the groups for a specified user.

I don't think there is an easy fix here.

I already searched the whole code to check the impact of commenting out yours. The unrelated issue is unrelated, and the fix is not yet in cvs.
Title: Re: phpbb bridging not working, fresh install
Post by: donnoman on May 08, 2005, 10:25:10 pm
Ahh sorry Casper, I didn't realise that.

Perhaps Nibbler can test the uploader code when he's finished with the admin fix.
Title: Re: phpbb bridging not working, fresh install
Post by: donnoman on May 08, 2005, 10:29:14 pm
Nibbler, the group code is synced to coppermine, and thats how users can establish that they are the gallery admin period. Thats how coppermine works.

It's immaterial how the forum stores the information, the bridge HAS to give it to coppermine in that form, it has nothing to do with the uploader code.

The uploader code is just looking for the same thing that the rest of coppermine looks for to see if a user is "GALLERY_ADMIN".

Fix the admin problem, uploader code should work.
Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 08, 2005, 10:31:31 pm
Commited fix, update phpbb bridge and udb_core. Ignore updated picmgmt.inc.php.

Don't try to tell me how coppermine works.
Title: Re: phpbb bridging not working, fresh install
Post by: donnoman on May 08, 2005, 10:33:44 pm
Did you test the uploader code?
Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 08, 2005, 10:35:05 pm
Check here (http://dictionary.reference.com/search?q=unrelated)
Title: Re: phpbb bridging not working, fresh install
Post by: donnoman on May 08, 2005, 10:38:22 pm
I guess I'm going to have to rely on Casper.

Casper, when your admin problem with phpbb is taken care of would you mind testing the uploader code to see if it still causes a problem.

Thanks.

Nibbler, you can click here (http://dictionary.reference.com/search?q=disobliging)
Title: Re: phpbb bridging not working, fresh install
Post by: Casper on May 08, 2005, 10:47:10 pm
Tommy,

all works fine now, with the one exception, which is when trying to view users from the gallery admin menu, which brings this error;

Quote
While executing query "SELECT user_id as user_id, username as user_name, user_email as user_email, user_regdate as user_regdate, user_lastvisit as user_lastvisit, user_active as user_active, COUNT(pid) as pic_count, ROUND(SUM(total_filesize)/1024) as disk_usage, group_name, group_quota FROM `clive_cpg`.phpbb_users AS u INNER JOIN devel_usergroups AS g ON u.group_id+100 = g.group_id LEFT JOIN devel_pictures AS p ON p.owner_id = u.user_id GROUP BY user_id ORDER BY user_regdate DESC LIMIT 0, 25;" on 0

mySQL error: Unknown column 'u.group_id' in 'on clause'
Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 08, 2005, 10:53:26 pm
Comment out this line

Code: [Select]
function view_users() {}
in the bridge file. The users page should be redirecting still, I'll add user list support for phpbb shortly.
Title: Re: phpbb bridging not working, fresh install
Post by: Nibbler on May 08, 2005, 11:04:35 pm
User list view enabled in phpbb.inc.php 1.40
Title: Re: phpbb bridging not working, fresh install
Post by: Casper on May 08, 2005, 11:06:35 pm
Yep, that did it. (1.39)

Donnoman, trying the original code now with the fixed bridge file still causes a db error,

Quote
While executing query "SELECT user_id as user_id FROM `clive_cpg`.phpbb_users WHERE group_id in (1)" on 0

mySQL error: Unknown column 'group_id' in 'where clause'

With the code commented out, it works fine.
Title: Re: phpbb bridging not working, fresh install
Post by: donnoman on May 09, 2005, 12:07:15 am
I finally see what Nibbler was saying.

Yes, I have to concur I don't see how we can get there from here without making changes to the bridge files for each forum that doesn't use a group_id field in the user table.

The only way I see to reliably implement the feature is to add functions for this specific purpose to the bridge files, it will have to wait until 1.5 or NG.

Leave it disabled.