Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2 3   Go Down

Author Topic: [cpg1.4.x]: PHPBB3 bridge  (Read 104217 times)

0 Members and 1 Guest are viewing this topic.

Nibbler

  • Guest
[cpg1.4.x]: PHPBB3 bridge
« on: July 04, 2008, 07:37:20 pm »

Supported phpbb3 bridge file attached. Download, extract, upload into the bridge folder. Then edit bridgemgr.php and add in the details for it as follows

Find

Code: [Select]
// define the var array

After that, add:

Code: [Select]
$default_bridge_data['phpbb3'] = array(
  'full_name' => 'phpBB version 3',
  'short_name' => 'phpbb3',
  'support_url' => 'http://www.phpbb.com/',
  'full_forum_url_default' => 'http://www.yoursite.com/board',
  'full_forum_url_used' => 'mandatory,not_empty,no_trailing_slash',
  'relative_path_to_config_file_default' => '../board/',
  'relative_path_to_config_file_used' => 'lookfor,config.php',
  'use_post_based_groups_default' => '0',
  'use_post_based_groups_used' => 'radio,1,0',
   'cookie_prefix_default' => '',
   'cookie_prefix_used' => 'cookie',
);

If you want to enable logout redirection it seems you need to hack phpbb to support this. This step is optional.

edit the phpbb file ucp.php

find:

Code: [Select]
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));

$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a> ');
   
      
change to :

Code: [Select]
meta_refresh(3, request_var('redirect', append_sid("{$phpbb_root_path}index.$phpEx")));

$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . request_var('redirect', append_sid("{$phpbb_root_path}index.$phpEx")) . '">', '</a> ');

That tells phpbb to look for the redirect parameter being passed in the url.

After that, install the bridge using the bridge manager.

Feedback welcome, especially since I don't use phpbb myself. If you have issues please remember to provide all the requested information.

Note: This bridge file only works 'out of the box' for new installs of phpbb3. If your forum has been upgraded from phpbb2 then you need to make this code change below.

Edit phpbb3.inc.php, find

Code: [Select]
$this->admingroups = array(5);

Change the 5 to the admin group in phpbb3. You can find this out by doing the following

Quote
Go to your forum, log into AdminCP; click on the tab "Users and Groups" and go to "Manage groups". you'll see all your forum groups now and next to them 3 links (Settings/Members/Delete); click on "Settings" next to the group you want to give portal admin permissions. now take a look at the address line, which should similarly to this:

http://yourdomain.com/phpbb3/adm/index.php?i=groups&sid=[randomnumbersandletters]&icat=12&mode=manage&action=edit&g=64

In our example above, the group's ID is 64;
« Last Edit: March 24, 2009, 03:17:40 pm by Nibbler »
Logged

rphMedia

  • Contributor
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 515
  • ***muvipix.com***
    • muvipix - Music | Video | Pictures
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #1 on: July 07, 2008, 08:26:11 pm »

Just FYI Nibbler, I can't get yours to work. I've had a (hack) bridge in place for phpBB3 since Feb 2007 and it's worked flawlessly.

Can't login at all. Takes me to the forum (logged in), but upon returning to the gallery, still have login option.

Disabled the bridge via the database, still can't login. I get the CPG login screen, but it takes me to the gallery home and still have the login option. Totally lost here as I have the bridging disabled ??

Deleted all cookies, same thing. I have no core-code mods.

Am I missing something?



(I've since enabled the previous hack and I'm back to our original).

rphMedia

  • Contributor
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 515
  • ***muvipix.com***
    • muvipix - Music | Video | Pictures
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #2 on: July 08, 2008, 12:45:28 pm »

OK, this has nothing to do with your bridge file. I'm trying to hunt the problem down.

fornit

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 8
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #3 on: July 16, 2008, 11:03:49 am »

Hi,

I've just taken a look into phpbb3.inc.php

Well ... to be honest, I'm not really sure whether everything has been considered.

Are you aware that there are three types of cookies in phpBB3 with respect to session management ("_sid", "_u" and "_k") cookies?

Are you also aware that there is a parameter named "session_length" in phpBB3 which limits the validity of session?

And are you aware that "user_level" is an attribute which has existed in the user table of phpbb2 but doesn't exist in phpbb3 any more?


These are only a few points after having a very quick look ...

Kind reagrds
fornit
Logged

Nibbler

  • Guest
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #4 on: July 16, 2008, 11:09:19 am »

No, since I don't use PHPBB. That's the point of releasing the file and getting feedback. I will look into these things.
Logged

Raven24

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 25
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #5 on: July 16, 2008, 01:37:02 pm »

The thing I can say about this bridge is that at least the ids from the user galleries are correctly matched with the usernames from the phpBB DB.
But as mentioned before login, etc. doesn't work... but thank you for working on a bridge!
Logged

mathias.frei

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #6 on: July 16, 2008, 03:09:33 pm »

If i upload this Mod, i have follow Error-Message:

Quote
Fatal error: Cannot redeclare cpggetmicrotime() (previously declared in /home/www/web373/html/pa-po/gallery/include/init.inc.php:35) in /home/www/web373/html/pa-po/gallery/include/init.inc.php on line 33

Is there a solution for this problem?
Logged

Nibbler

  • Guest
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #7 on: July 16, 2008, 03:11:58 pm »

You probably put the wrong path in 'relative path to your BBS' and pointed back to Coppermine instead of phpbb.
Logged

mathias.frei

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #8 on: July 16, 2008, 04:00:08 pm »

The transmission works well, it was the relative path. Now I can log in the forum, but in the gallery, I am not logged in. The Cookies has the same name and the Path is the same.
Logged

Nibbler

  • Guest
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #9 on: July 16, 2008, 04:18:06 pm »

There's a typo in the bridge file.

Code: [Select]
$session_id = addslashes($_COOKIE[$this->cookie_name . '_sid']);
That should be

Code: [Select]
$this->session_id = addslashes($_COOKIE[$this->cookie_name . '_sid']);
*Now fixed in the version posted*
« Last Edit: July 17, 2008, 02:57:10 pm by Nibbler »
Logged

Dogbot

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #10 on: July 16, 2008, 08:06:02 pm »

Many thanks Nibbler for releasing this bridge file for phpbb/coppermine users.

I found some code elsewhere here on the site for autocreating albums, here it is..do you think this will work with your bridge file or do you know a better way of doing it.

Code: [Select]

function authenticate()
        {
                global $USER_DATA, $CONFIG;

                if (!($auth = $this->session_extraction()) && !($auth = $this->cookie_extraction())) {
                        $this->load_guest_data();
                } else {
                        list ($id, $cookie_pass) = $auth;
                        $f = $this->field;

                        if (isset($this->usergroupstable)){
                                $sql = "SELECT u.{$f['user_id']} AS id, u.{$f['username']} AS username, u.{$f['password']} AS password,

ug.{$f['usertbl_group_id']} AS group_id ".
                                           "FROM {$this->usertable} AS u, {$this->usergroupstable} AS ug ".
                                           "WHERE u.{$f['user_id']}=ug.{$f['user_id']} AND u.{$f['user_id']}='$id'";
                        } else {
                                $sql = "SELECT u.{$f['user_id']} AS id, u.{$f['username']} AS username, u.{$f['password']} AS password,

u.{$f['usertbl_group_id']}+100 AS group_id ".
                                           "FROM {$this->usertable} AS u INNER JOIN {$this->groupstable} AS g ON

u.{$f['usertbl_group_id']}=g.{$f['grouptbl_group_id']} ".
                                           "WHERE u.{$f['user_id']}='$id'";
                        }

                        $result = cpg_db_query($sql, $this->link_id);

                        if (mysql_num_rows($result)){
                                $row = mysql_fetch_assoc($result);
                                mysql_free_result($result);

                                $db_pass = $this->udb_hash_db($row['password']);
                                if ($db_pass === $cookie_pass) {
                                        $this->load_user_data($row);
                                } else {
                                        $this->load_guest_data();
                                }
                        } else {
                                $this->load_guest_data();
                        }
                }

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

        $USER_DATA = array_merge($USER_DATA, $this->get_user_data($USER_DATA['groups'][0], $USER_DATA['groups'], $this->guestgroup));

                if ($this->use_post_based_groups){
                        $USER_DATA['has_admin_access'] = (in_array($USER_DATA['groups'][0] - 100,$this->admingroups)) ? 1 : 0;
                } else {
                        $USER_DATA['has_admin_access'] = ($USER_DATA['groups'][0] == 1) ? 1 : 0;
                }

                $USER_DATA['can_see_all_albums'] = $USER_DATA['has_admin_access'];

                // avoids a template error
                if (!$USER_DATA['user_id']) $USER_DATA['can_create_albums'] = 0;

                // For error checking
                $CONFIG['TABLE_USERS'] = '**ERROR**';


                define('USER_ID', $USER_DATA['user_id']);
        define('USER_NAME', addslashes($USER_DATA['user_name']));
        define('USER_GROUP', $USER_DATA['group_name']);
        define('USER_GROUP_SET', $user_group_set);
        define('USER_IS_ADMIN', $USER_DATA['has_admin_access']);
        define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
        define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
        define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
        define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
        define('USER_CAN_CREATE_ALBUMS', (int)$USER_DATA['can_create_albums']);
        define('USER_UPLOAD_FORM', (int)$USER_DATA['upload_form_config']);
        define('CUSTOMIZE_UPLOAD_FORM', (int)$USER_DATA['custom_user_upload']);
        define('NUM_FILE_BOXES', (int)$USER_DATA['num_file_upload']);
        define('NUM_URI_BOXES', (int)$USER_DATA['num_URI_upload']);

        //Autocreating albums
        if($USER_DATA['user_id'] != 0)
        {
                $cid = 10000 + $USER_DATA['user_id'];
                $sql = "SELECT aid FROM cpg14x_albums WHERE category = " . $cid;
                $result = cpg_db_query($sql);
                if(mysql_num_rows($result) == 0)
                {
                        $sql = "INSERT INTO cpg14x_albums (category, title, uploads, pos) VALUES ('$cid', 'My Album', 'NO',  '1')";
                        cpg_db_query($sql);
                }
                mysql_free_result($result);
        }
                $this->session_update();
        }

Many thanks once again !

Dogbot.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #11 on: July 17, 2008, 08:12:08 am »

Do not clutter this thread with unrelated stuff - start a thread of your own instead on the regular support board, providing the needed details there.
Logged

mathias.frei

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #12 on: July 17, 2008, 09:07:58 am »

There's a typo in the bridge file. (...)

Thank you very much. The bridge works properly.
Logged

Raven24

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 25
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #13 on: July 17, 2008, 02:45:36 pm »

Yes, works here too! Thank you VERY much!
Logged

simplysnaps

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #14 on: July 25, 2008, 01:09:00 pm »

I have just installed this and when I click login in coppermine it takes me to the phpbb3 login page, I then login which works fine but when I go back to the gallery I'm not logged in and of course clicking the login option takes me to the phpbb3 page where I am logged in?

help please
Logged

Nibbler

  • Guest
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #15 on: July 25, 2008, 01:30:04 pm »

If you have issues please remember to provide all the requested information.
Logged

simplysnaps

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #16 on: July 25, 2008, 01:41:17 pm »

apologies for that being harrassed and missed the two obvious things

1) post correct info when asking for help

2) remember to get the cookie prefix correct or the gallery wont find the cookie that says you are logged in :-)

all working now  ;D
Logged

Imaboyo

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #17 on: July 27, 2008, 04:53:17 pm »

I am having some problems trying to get this bridge completely working. My phpBB database is a conversion from the 2.x series and I think this might be having an effect on the bridge. I am using phpBB 3.0.2 and coppermine 1.4.18. I have already had to modify the bridge slightly to make me recognised as an administrator. The admin group was hard coded as 5 (line 112) where this is very much different in a converted board.

The gallery recognises that I am logged in, both with admin accounts and standard user accounts. When I visit the groups tab while logged in as admin the bridge fails to import the groups from phpbb so I am unable to apply permissions to any usergroups. Only the four default coppermine groups are displayed (Admin, Registered, Guests & Banned).

Can anyone suggest something I can do to try and fix this?
Logged

Nibbler

  • Guest
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #18 on: July 27, 2008, 05:09:32 pm »

Did you enable 'post based groups' when you activated the bridge?
Logged

rphMedia

  • Contributor
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 515
  • ***muvipix.com***
    • muvipix - Music | Video | Pictures
Re: [cpg1.4.x]: PHPBB3 bridge
« Reply #19 on: July 27, 2008, 05:13:55 pm »

FWIW, I'm having the exact same problem (yes on Post-based groups)
Pages: [1] 2 3   Go Up
 

Page created in 0.03 seconds with 19 queries.