forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 bridging => Topic started by: zorbas2 on February 09, 2015, 04:20:54 pm

Title: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 09, 2015, 04:20:54 pm
I have the following issue when trying to bridge coppermine and phpBB3:
[error message or problem description here]

Coppermine install: http://www.zorbas.de/scripts/cpgGallery/
Bridging app install: http://www.zorbas.de/scripts/cpgGallery/
Coppermine version: cpg1.5.34
Bridging app version: phpBB 3.1.3
Test user account: testuser / usertest

BridgeManager settings:
Bridge app URL:  http://www.zorbas.de/scripts/phpBB3
Relative path to your bridge app's config file:  ../phpBB3/
Cookie name or prefix:  phpbb3
Use bridge app custom groups?:  No

When clicking on "login" in coppermine it redirects me to the board login.
After logging into the board it won't redirect me back to coppermine.
When accessing the gallery directly I am still not logged in and I can disable the bridge only by directly accessing the bridgemgr.php
I left the bridge active now ffor further testing purposes...
I hope I get help on this as my users would really appreciate the bridge!
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 09, 2015, 04:31:50 pm
One issue was obviously the cookie:
Since I changed it from phpbb3 to phpbb3_b5ygn I am logged in also in coppermine, but I still don't get redirected after logging in by the board...
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Phill Luckhurst on February 09, 2015, 05:30:21 pm
The redirection is something that needs an edit to phpBB. If you search their boards the edits are detailed in a number of places.
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 09, 2015, 05:59:00 pm
I found something in the manual here: http://documentation.coppermine-gallery.net/en/bridging.htm#integrating_individual_bridge_issues_phpbb3

But this is only regarding the logout
AND in my ucp.php I am not able to find:

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> ');


Would you please be so kind to point me to the correct posting as I can not find it??
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 10, 2015, 04:51:51 pm
Unfortunately couldn't find any help regarding the non.functional redirect when bridging. So I deactivated the bridge for now.
But I am still looking for help regarding this!!
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 10, 2015, 04:56:26 pm
One more thing:
When the bridge was still enabled I tried to send an ecard and got the following error:

09. Februar 2015 um 22:01 - While executing query 'SELECT *, username AS user_name, user_email AS user_email, user_regdate AS user_regdate, user_from AS user_location, user_website AS user_website FROM `db466936751`.phpbb3_users WHERE user_id = '2'' in bridge/udb_base.inc.php on line 413 the following error was encountered: 
Unknown column 'user_from' in 'field list'


Now as the bridge is disabled the gallery is sending no emails at all (new user registration/ecards) except the contact form. But that's another topic...
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 13, 2015, 11:12:48 am
I am using version 1.5.34 as stated in my initial post.
I am NOT editing files. I am using the bridge manager.
However, this does not explain the error when trying to send an ecard.
I have now disabled the bridge in the bridge manager as neither redirects nor ecards would work.
What do you suggest to do to get the bridge working??
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Αndré on February 13, 2015, 08:52:09 pm
Quote
While executing query 'SELECT *, username AS user_name, user_email AS user_email, user_regdate AS user_regdate, user_from AS user_location, user_website AS user_website FROM `db466936751`.phpbb3_users WHERE user_id = '2'' in bridge/udb_base.inc.php on line 413 the following error was encountered:
Unknown column 'user_from' in 'field list'


Quote from: bridge/udb_base.inc.php
        $sql = "SELECT *, {$this->field['username']} AS user_name, "
                . "{$this->field['email']} AS user_email, "
                . "{$this->field['regdate']} AS user_regdate, "
                . "{$this->field['location']} AS user_location, "
                . "{$this->field['website']} AS user_website "
            . "FROM  {$this->usertable} WHERE {$this->field['user_id']} = '$uid'";
        $result = cpg_db_query($sql, $this->link_id);


Quote from: bridge/phpbb3.inc.php
            // Table field names
            $this->field = array(
                'username' => 'username', // name of 'username' field in users table
                'user_id' => 'user_id', // name of 'id' field in users table
                'password' => 'user_password', // name of 'password' field in users table
                'email' => 'user_email', // name of 'email' field in users table
                'regdate' => 'user_regdate', // name of 'registered' field in users table
                'active' => 'user_active', // is user account active?
                'lastvisit' => 'user_lastvisit', // name of 'location' field in users table
                'location' => 'user_from', // name of 'location' field in users table
                'website' => 'user_website', // name of 'website' field in users table
                'usertbl_group_id' => 'group_id', // name of 'group id' field in users table
                'grouptbl_group_id' => 'group_id', // name of 'group id' field in groups table
                'grouptbl_group_name' => 'group_name' // name of 'group name' field in groups table
            );


This means you need to update the bridge files, as it doesn't seem to be compatible with your phpBB version.
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 14, 2015, 09:13:59 am
Thank you for your help!!  :)
I am trying to always use the latest version of phpBB (currently 3.1.3) and cpg (currently 1.5.34)

Am I right that you want me to edit phpbb3.inc.php and add the line
Code: [Select]
'location' => 'user_from', // name of 'location' field in users table
I was also searching on the coppermine-gallery.net website if there is a central location to find the latest bridge files - no luck. Or am I missing something here??
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Αndré on February 14, 2015, 09:56:26 am
If the bridge files aren't included in the Coppermine package, you may find them here in the bridge or bridge contributions board.
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 14, 2015, 11:05:48 am
Thanks André,

That's where I probably found them.
But what you mean by
Quote from: André
If the bridge files aren't included in the Coppermine package ...
I was checking the 'cpg1.5 bridging' forum right now and as I did not find the files right away I ask myself is the following:
Why is there not a 'sticky' topic for those files at the top of the forum?? That would make it much easier to always find the latest bridge files...

And regarding my question: Should I add now the line you mentioned to my phpbb3.inc.php ??
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Αndré on February 14, 2015, 11:23:38 am
You don't need to add that line, but adjust it, so it matches your phpBB database. Obviously something changed, as the field was either renamed, moved or removed.
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 14, 2015, 11:49:40 am
In my database (phpBB  3.1.3)

in the table
'prefix_users' there is no field anymore corresponding to 'location'

However, this field is found now in the table
'prefix_profile_fields_data' named as 'pf_phpbb_location'

What I would have to do in this case?
Maybe someone is willing to adapt the phpbb.inc.php to the phpBB 3.1.x version? It seems quite a lot has changed...
And there is still the redirect issue also...
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Phill Luckhurst on February 14, 2015, 01:35:11 pm
Again, the redirect has to be done by editing the phpBB files, not the Coppermine files. That is something better asked over at the phpBB forums as we do not know their code.

I'll try and do an install of phpBB locally tomorrow and see what changes there are.
Title: Re: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 14, 2015, 01:56:41 pm
Again, the redirect has to be done by editing the phpBB files, not the Coppermine files.
Got that. In ucp.php as I understood...

I'll try and do an install of phpBB locally tomorrow and see what changes there are.
That would be great!!

That is something better asked over at the phpBB forums as we do not know their code.
I will do so...
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Αndré on February 14, 2015, 07:44:50 pm
Phill, according to this post (http://forum.coppermine-gallery.net/index.php/topic,77947.msg376753.html#msg376753), some field names have changed and some fields have been moved to a new table. Unfortunately the user hasn't posted more details what exactly has been changed, but maybe this can be found somewhere in the release notes of phpBB 3.1.


I'll try and do an install of phpBB locally tomorrow and see what changes there are.
I'll do this now and post what I found out when I finish my work today.
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Αndré on February 14, 2015, 08:07:36 pm
The file install/convertors/convert_phpbb20.php contains a map of new -> old (table +) field names, e.g.
Quote
         array(
            'target'      => PROFILE_FIELDS_DATA_TABLE,
            'primary'      => 'users.user_id',
            'query_first'   => array(
               array('target', $convert->truncate_statement . PROFILE_FIELDS_DATA_TABLE),
            ),

            array('user_id',            'users.user_id',               'phpbb_user_id'),
            array('pf_phpbb_occupation',   'users.user_occ',               array('function1' => 'phpbb_set_encoding')),
            array('pf_phpbb_interests',      'users.user_interests',            array('function1' => 'phpbb_set_encoding')),
            array('pf_phpbb_location',      'users.user_from',               array('function1' => 'phpbb_set_encoding')),
            array('pf_phpbb_icq',         'users.user_icq',               array('function1' => 'phpbb_set_encoding')),
            array('pf_phpbb_wlm',         'users.user_msnm',               array('function1' => 'phpbb_set_encoding')),
            array('pf_phpbb_yahoo',         'users.user_yim',               array('function1' => 'phpbb_set_encoding')),
            array('pf_phpbb_aol',         'users.user_aim',               array('function1' => 'phpbb_set_encoding')),
            array('pf_phpbb_website',      'users.user_website',            'validate_website'),

            'where'         => 'users.user_id <> -1',
         ),
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Αndré on February 14, 2015, 08:33:03 pm
The current code in udb_base.inc.php doesn't support joining other tables. But as neither user_location nor user_website is used anywhere in the rest of the Coppermine code (at least I haven't found a direct access to it), we can simply replace
Code: [Select]
                'location' => 'user_from', // name of 'location' field in users table
                'website' => 'user_website', // name of 'website' field in users table
with
Code: [Select]
                'location' => "''", // name of 'location' field in users table
                'website' => "''", // name of 'website' field in users table

This should fix the error message when bridged to phpBB 3.1 and should also work with phpBB 3.0. If somebody can verify that it works for both, I'll update the bridge file accordingly.
Title: Re: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 15, 2015, 07:46:55 pm
Sounds easy. Thank you. Will try that with my phpBB 3.1.x  :)
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 15, 2015, 08:15:00 pm
I changed the lines in my phpbb3.inc.php as you suggested and did the following:
- uploaded edited phpbb3.inc.php
- enabled bridging
- logged out.
- Logging in at coppermine --> got redirected to phpbb. Logged in there. --> No redirect back to cpg
- Manually went back to cpg and I was logged in.
- Tried to send an ecard --> Message that the card was send and no errors anymore. BUT the card was not received in the end!!
- Tried to send a contact mail --> Received it immediately.
- Disabled bridge
- Checked registration settings and group settings --> nothing changed as I can see.
- Tried again to send an ecard --> Message that the card was send and no errors anymore. BUT the card was not received in the end!! And this was working before enabling the bridge!!

Dunno watodo now...
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 15, 2015, 08:19:05 pm
Can someone beat me please??  :o
ecards went again in the spam folder. With bridge enabled and without...  :-[
But what about the redirecting back from phpbb after logging in??
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Αndré on February 15, 2015, 08:25:01 pm
But what about the redirecting back from phpbb after logging in??

Phill already told you twice what to do!
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 15, 2015, 08:30:17 pm
I started a thread in the phpbb forums, but no luck yet...
https://www.phpbb.com/community/viewtopic.php?f=496&t=2297011&p=13955291#p13954221 (https://www.phpbb.com/community/viewtopic.php?f=496&t=2297011&p=13955291#p13954221)
Title: Re: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Phill Luckhurst on February 15, 2015, 10:56:59 pm
The current code in udb_base.inc.php doesn't support joining other tables. But as neither user_location nor user_website is used anywhere in the rest of the Coppermine code (at least I haven't found a direct access to it), we can simply replace
Code: [Select]
                'location' => 'user_from', // name of 'location' field in users table
                'website' => 'user_website', // name of 'website' field in users table
with
Code: [Select]
                'location' => "''", // name of 'location' field in users table
                'website' => "''", // name of 'website' field in users table

This should fix the error message when bridged to phpBB 3.1 and should also work with phpBB 3.0. If somebody can verify that it works for both, I'll update the bridge file accordingly.

All seems to work fine for me in both versions.
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Phill Luckhurst on February 15, 2015, 10:58:19 pm
ecards went again in the spam folder. With bridge enabled and without...  :-[
That will be a setting on your mail client. Nothing we can do to help with that.
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 16, 2015, 08:08:13 am
Thanks Phill for checking this out.
Of course the fact that the ecards went into my spam folder was my or the mail client fault...
So the adjusted phpbb3.inc.php by Andé works fine now!  :D

However, I don't understand why the login/logout redirects were working with your local fresh installs of both, cpg 1.5.34 and phpBB 3.1.3
Both, cpg and phpbb are updated versions and not fresh installs on my server.
Do you think it would be a good idea to do a fresh install of both to get this bl&*!dy redirect working?
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Phill Luckhurst on February 16, 2015, 01:12:15 pm
No, the redirects do not work on my install unless I modify files on phpBB. As I am only testing there is no need for me to go down the route of learning the edits to phpBB. They are documented on the phpBB site, at least they were for older versions and probably on these forums too. Hopefully someone from phpBB will respond on their forums.
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 16, 2015, 04:15:59 pm
Ok! That explais a lot.
So I am going on to chase the subject on phpbb forums.
In case I find a solution, I will post it to this thread...
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 16, 2015, 05:20:32 pm
Just found the following on the German phpBB board (https://www.phpbb.de/community/viewtopic.php?f=6&t=81442) for older versions:

Quote
Create a file in your phpBB root directory named cpg_redir.php
Content:
Code: [Select]
<?php
if (!$_SERVER['HTTP_HOST']) {
  
$cpg_host=$HTTP_SERVER_VARS['HTTP_HOST'];
} else {
  
$cpg_host=$_SERVER['HTTP_HOST'];
}
$cpg_path='/gallery';
header("Location: http://".$cpg_host.$cpg_path);
exit;
?>
Could that still do the trick??
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Αndré on February 16, 2015, 05:40:48 pm
Please unterstand that we're not the phpBB support. Either test it yourself or ask the phpBB team/community.
Title: Re: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 16, 2015, 07:38:47 pm
Please unterstand that we're not the phpBB support. Either test it yourself or ask the phpBB team/community.

I completely understand that. I do not really await support from you directly, just thought that there may be other users of coppermine with the same problem. And solving problems is for the benefit of everyone - isn't it?
However, I think that Coppermine - a great and popular program, which I use for many years now - should also have at least some interest that bridges to other popular community scripts work and like this make both even more interesting...
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: Αndré on February 16, 2015, 09:18:18 pm
Made phpBB 3 bridge compatible with phpBB version 3.1.x in SVN revision 8772.
Title: Re: cpg1.5.34 bridged with phpbb 3.1.3 but after login no access to gallery
Post by: zorbas2 on February 17, 2015, 03:46:45 pm
I made it!!  8)
Redirects working perfectly...

I created a file 'redirect.php' for the phpBB root folder:

My redirect.php:
Code: [Select]
<?php
define
('IN_PHPBB'true);
$phpbb_root_path './';
$phpEx substr(strrchr(__FILE__'.'), 1);
include(
$phpbb_root_path 'common.' $phpEx);

$redirect_target '../CoppermineFolder';    /* Path to Coppermine!  */

$user->session_begin(); 
$auth->acl($user->data);

if(!
$user->data['is_registered'])
{
login_box($redirect_target);
}
else if (
$user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid''') === $user->session_id)
        {
            
$user->session_kill();
        }

redirect($redirect_target);

And changed the following part in phpbb3.inc.php:
Code: [Select]
.
.
.

        function login_page()
        {
            global $CONFIG;

            $redirect = urlencode($CONFIG['site_url']);
            $this->redirect("/redirect.php");
        }

        function logout_page()
        {
            global $CONFIG;

            $redirect = urlencode($CONFIG['site_url']);
            $this->redirect("/redirect.php?mode=logout&redirect=$redirect&sid=" . $this->session_id);
        }
.
.
.