forum.coppermine-gallery.net

Dev Board => cpg1.4 Testing/Bugs => cpg1.4 Testing/Bugs: FIXED/CLOSED => Topic started by: alfisti.net on December 24, 2009, 01:43:07 pm

Title: [Fixed]: Vbulletin 4.0 with cpg 1.4.25
Post by: alfisti.net on December 24, 2009, 01:43:07 pm
Hi,

I testet the bridge today with:
4.0 "Gold" (upgraded from 3.8)
Coppermine 1.4.25 (brand new installation / using bridge manager)

It work fine :)
Usergroups, usernames and I guess also all right-settings (I have checked only two, but I am sure that all other will also work).

I only have some problems with the collation / character encoding but I guess this is a problem from the database collation (UTF8 works fine for the gallery phrases, Western-ISO 8859-1 works fine for the usernames with german characters).

Happy x-mas
André
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Joachim Müller on December 25, 2009, 03:59:16 pm
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: alfisti.net on December 26, 2009, 01:38:31 pm
Hi Joachim,

I want to learn what I made wrong :) I don't understand your link.
This is just for information that the bridge works fine because I found nothing about vB 4.0 in the forum (and vB3 is only named in the Bridge Manager).
I can't post a link because my installation is only a non-public testversion (licence agreements of vB: use only 1 installation with public access).

I wrote the note for collation incompatiblity because it happened to my test. But I' am sure that this is a problem of my installation and not a problem of the bridge :)

Regards
André
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: phill104 on December 26, 2009, 09:39:28 pm
The link Joachim posted is requesting that you post a link to your gallery. This is mandatory as per the board rules. It is very hard to look into a problem if we cannot see it.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: alfisti.net on January 16, 2010, 02:01:03 pm
The bridge will not work anymore with vB 4.01 :(

I have had problems with the cookie salt in a older version after an update.
vBulletin changed the value of the cookie_salt from the licence number to a random number which comes with the download.
The value is written in the file /includes/function.php of vB
Code: [Select]
define('COOKIE_SALT', 'ZUShshsgdhTZTUJS');The value is only a sample.

I found nothing special in the documentation how the bridge is working exactly.
Is it possible that this is the reason why it don't work anymore?

Thanks

Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Joachim Müller on January 16, 2010, 10:59:51 pm
Ignoring our request to post a link to your gallery will result in your subsequent postings getting ignored.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: codjo on January 17, 2010, 01:14:24 pm
Here is a link to my gallery with the same problem: http://www.mishki.de/Forum/content.php?6-Galerie

I have also vbulletin 4.0.1 installed and after this I can not connect anymore to the coppermine gallery.
After typing the link to the gallery I see login and when I click this I come to the starting page of my forum.

greetings
Jochen
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: codjo on January 17, 2010, 02:11:33 pm
Username and password for checking is possible to give you but I don´t want to post this here in this public area, maybe I can send it somehow (E-Mail or equal) without need of posting it here.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: alfisti.net on January 17, 2010, 02:53:23 pm
make a test account with no further rights. The support don't need a admin account!
Only a standard user... So that Joachim can see what happens with the cookies.
And after Joachim tested this, you can delete this user.

@Joachim
As I wrote you in the thread, I have no public version, only a testversion.
I ask for a hint to find the problem, I don't asked for a solution ;)

And my first post was only posted to let you know that vB 4.0 will work fine with the bridge, I don't asked for support.


Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: codjo on January 17, 2010, 04:16:17 pm
Ok, here is the link again and the User and Password:

Coppermine install: http://www.mishki.de/cpg1410/
Forum install: http://www.mishki.de/Forum/
Coppermine version: cpg1.4.25
Forum version: Vbulletin 4.0.1
Test user account: Testuser / test123


Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: codjo on January 19, 2010, 09:26:23 pm
It is working now, I found the solution in the vbulletin board: http://www.vbulletin.com/forum/project.php?issueid=35386

The problem is, that vbulletin have changed the cookie prefix from bb to bb_

Code: [Select]
$config['Misc']['cookieprefix'] = 'bb_';
After this change, it is working.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Joachim Müller on January 20, 2010, 08:15:31 am
Thanks for your report. However, the fix might do the job, but is not right as far as application design is concerned. I have posted this on the vB forum:
Quote from: http://www.vbulletin.com/forum/project.php?issueid=35386
At vB devs:
Your proposed fix is to populate a third-party file (coppermine's include/config.inc.php, seen from your perspective, is a third party file) with a variable from your app? And that is supposed to be a true, genuine fix?
I'm not a vBulletin expert, but as far as I can see you store your settings inside the $config array, which is available for processing for third party apps (that's what the coppermine bridge for vbulletin does): we use PHP's require_once command to include vB's file includes/config.php. The corresponding code in bridge/vbulletin30.inc.php is            $this->boardurl = $BRIDGE['full_forum_url'];
            require_once($BRIDGE['relative_path_to_config_file'] . 'includes/config.php');
            $this->use_post_based_groups = $BRIDGE['use_post_based_groups'];
This is meant to give us access to all of your settings inside the $config-array, as we later use          // Running on vBulletin 3.5.x
            $this->db = array(
                'name' => $config['Database']['dbname'],
                'host' => $config['MasterServer']['servername'] ? $config['MasterServer']['servername'] : 'localhost',
                'user' => $config['MasterServer']['username'],
                'password' => $config['MasterServer']['password'],
                'prefix' => $config['Database']['tableprefix']
            );
Due to vB not being FOSS I don't have a copy of vB to test this, so I can't tell for sure. But judging from the fact that manually populating $config['Misc']['cookieprefix'] = 'bb_'; in a coppermine file fixes the issue for the posters here means that the scope of that variable is wrong in your application or that it get's populated at a later stage. The expected reply from vB staff would have been "we don't support third-party applications like Coppermine", which is at least what we tell users who ask questions about vBulleting on our forum. Blaming Coppermine to be at fault sounds lame to me though: upgrading your app broke the bridge, and it turns out that it happens because of something the vB devs changed in vBulletin (changing the cookie prefix from "bb" to "bb_").
We (the Coppermine developers) are not fond of a proposed "fix" that requires editing a coppermine component that is not related at all. If you must edit a coppermine file, edit bridge/vbulletin30.inc.php and add your proposed change there. Even better would be not to require end user to edit that file at all by modifying coppermine's bridge file with a little if/then toggle:
Code: [Select]
if (vB-Version >= 4) {
    $config['Misc']['cookieprefix'] = 'bb_';
}
would do the trick - we just need to figure out where the version number of vB is kept (in which variable or constant that is available for the third-party page). So my question at the vB devs is: is there a varibale that we could use, or do you have another proposal.

Joachim Müller (aka GauGau)
- Coppermine project manager -
I have moved your thread to the testing/bugs board, although this is not a genuine coppermine "bug".
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Nibbler on January 20, 2010, 12:11:44 pm
The proposed change is to vb's own config.php.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Nibbler on January 20, 2010, 12:17:14 pm
My suggestion would be to drop the auto-detection of the cookie prefix and instead prompt the admin for it in the bridge manager like some other bridges do.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: BAJR on January 23, 2010, 08:26:07 pm
I am sorry to say that the bb_  fix that I thought had worked - failed..  so who knows why it worked briefly.

I am a bit annoyed at Vbulletin as they have been quite offhand about 'whose problem is it'

At the end of the day...  Coppermine is the best gallery solution....   Vbulletin 4.0 is a great mix of CMS and Forum

as it stands I jsut can't join them.. will anybody be looking at creating a VB4  bridge.   ?



Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: codjo on January 25, 2010, 12:06:33 am
Maybe this will help to solve our problem, this work for me now since some time and it seems that this is the solution.

In the file cpgxxxx/bridge/vbulletin.30.inc.php you need to change the following:

Code: [Select]
[i]Search for:[/i]

if (isset($_COOKIE[$this->cookie_name . 'sessionhash'])) {

[i]and change it to:[/i]

if (isset($_COOKIE[$this->cookie_name . '[b]_[/b]sessionhash'])) {

[i]Then go one line down or search for: [/i]

$session_id = addslashes($_COOKIE[$this->cookie_name . 'sessionhash']);

[i]and change it to:[/i]

$session_id = addslashes($_COOKIE[$this->cookie_name . '[b]_[/b]sessionhash']);


Hope this helps finally!

Best regards

Jochen (aka Mishki)
(www.mishki.de)
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: codjo on January 25, 2010, 12:11:22 am
Maybe this will help to solve our problem, this work for me now since some time and it seems that this is the solution.

In the file cpgxxxx/bridge/vbulletin.30.inc.php you need to change the following:

Can somebody remove my previous post, I can not edit it and just saw that bold and italic not work inside of code Tag.

Code: [Select]
Search for:

if (isset($_COOKIE[$this->cookie_name . 'sessionhash'])) {

and change it to:

if (isset($_COOKIE[$this->cookie_name . '_sessionhash'])) {

Then go one line down or search for:

$session_id = addslashes($_COOKIE[$this->cookie_name . 'sessionhash']);

and change it to:

$session_id = addslashes($_COOKIE[$this->cookie_name . '_sessionhash']);


Hope this helps finally!

Best regards

Jochen (aka Mishki)
(www.mishki.de)
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Paul M on January 25, 2010, 02:25:44 am
Maybe this will help to solve our problem, this work for me now since some time and it seems that this is the solution.

In the file cpgxxxx/bridge/vbulletin.30.inc.php you need to change the following:

Can somebody remove my previous post, I can not edit it and just saw that bold and italic not work inside of code Tag.

Code: [Select]
Search for:

if (isset($_COOKIE[$this->cookie_name . 'sessionhash'])) {

and change it to:

if (isset($_COOKIE[$this->cookie_name . '_sessionhash'])) {

Then go one line down or search for:

$session_id = addslashes($_COOKIE[$this->cookie_name . 'sessionhash']);

and change it to:

$session_id = addslashes($_COOKIE[$this->cookie_name . '_sessionhash']);


Hope this helps finally!

Best regards

Jochen (aka Mishki)
(www.mishki.de)

That is the correct way to fix it.

In vB 4.0.1, all the session cookie names have changed, so sessionhash is now _sessionhash
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Joachim Müller on January 25, 2010, 08:34:59 am
Can somebody remove my previous post, I can not edit it and just saw that bold and italic not work inside of code Tag.
Actually, the instructions should look like this as far as correct bbcode is concerned:

Edit cpgxxxx/bridge/vbulletin.30.inc.php
Search for:
Code: [Select]
if (isset($_COOKIE[$this->cookie_name . 'sessionhash'])) {and change it to:
Code: [Select]
if (isset($_COOKIE[$this->cookie_name . '_sessionhash'])) {
Then go one line down or search for:
Code: [Select]
$session_id = addslashes($_COOKIE[$this->cookie_name . 'sessionhash']);and change it to:
Code: [Select]
$session_id = addslashes($_COOKIE[$this->cookie_name . '_sessionhash']);
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: BAJR on January 25, 2010, 04:25:13 pm
I am and ever will be in your debt..  and thank you so much for this help.   If only other groups were as helpful and precise as yourselves.

Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: phill104 on January 25, 2010, 05:34:47 pm
Codjo (Jochen {aka Miski}) and Paul M

Thank you for your contribution. As far as I know none of us have Vbulletin so we are unable to test the fix ourselves. Hopefully Paul (who appears to part of the Vb team) has tested and confirmed the fix. If it does indeed work I am sure our users will be pleased. The bridge appears to be functioning at Jochen's site running CPG 1.4.25.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Joachim Müller on January 25, 2010, 05:36:57 pm
Yes, thank you all.
If this can be confirmed by a member of the vB staff or enough "regular" vB users we will come up with a separate bridge file for vB4 and the corresponding options populated inside the bridge manager for the next Coppermine release.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: phill104 on January 28, 2010, 11:59:28 am
I have now managed to test this and it seems to be working fine on my test machine. Paul M also appears to be a member of the Vb team from his profile on the Vb forums.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Paul M on January 28, 2010, 07:46:29 pm
You dont need a seperate bridge, just something like this in your code to get the session id

Code: [Select]
$sessionid = $_COOKIE[$prefix . '_sessionhash']; // 4.0.1 +

if (empty($sessionid))
{     // 4.0.0 or before
      $sessionid = $_COOKIE[$prefix. 'sessionhash'];
}

:)
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Joachim Müller on January 29, 2010, 08:11:22 am
Thanks for the update. I have edited bridge/vbulletin30.inc.php and replaced
Code: [Select]
// definition of how to extract id, name, group from a session cookie
function session_extraction()
{
if (isset($_COOKIE[$this->cookie_name . 'sessionhash'])) {
$session_id = addslashes($_COOKIE[$this->cookie_name . 'sessionhash']);

$sql = "SELECT u.{$this->field['user_id']}, u.{$this->field['password']}, u.{$this->field['grouptbl_group_id']}+100 AS usergroupid FROM {$this->usertable} AS u, {$this->sessionstable} AS s WHERE s.{$this->field['user_id']}=u.{$this->field['user_id']} AND s.sessionhash='$session_id'";

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

if (mysql_num_rows($result)){
$row = mysql_fetch_array($result);
return $row;
} else {
    return false;
}
}
with
Code: [Select]
// definition of how to extract id, name, group from a session cookie
function session_extraction()
{
if (isset($_COOKIE[$this->cookie_name . '_sessionhash'])) {
    $session_id = addslashes($_COOKIE[$this->cookie_name . '_sessionhash']);
} elseif (isset($_COOKIE[$this->cookie_name . 'sessionhash'])) {
    $session_id = addslashes($_COOKIE[$this->cookie_name . 'sessionhash']);
}
if (isset($session_id)) {
$sql = "SELECT u.{$this->field['user_id']}, u.{$this->field['password']}, u.{$this->field['grouptbl_group_id']}+100 AS usergroupid FROM {$this->usertable} AS u, {$this->sessionstable} AS s WHERE s.{$this->field['user_id']}=u.{$this->field['user_id']} AND s.sessionhash='$session_id'";

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

if (mysql_num_rows($result)){
$row = mysql_fetch_array($result);
return $row;
} else {
    return false;
}
}
}
I am attaching the modified file to this posting (just download, then rename from vbulletin30.inc.php.txt back to vbulletin30.inc.php and replace your copy with the modified file). Please report if this works as expected.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Joachim Müller on January 31, 2010, 03:06:29 pm
Please confirm - I'd like to see this fix included with the upcoming maintenance release cpg1.4.26, which I can only do if someone confirms my suggestion.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: phill104 on January 31, 2010, 03:27:51 pm
I can test it tomorrow. I don't have vB but a mate in the office does and I can test on his machine.
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Joachim Müller on January 31, 2010, 03:34:24 pm
OK, thanks. I'm looking forward to your report. Cheers  ;D
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: alfisti.net on February 01, 2010, 09:18:25 am
Please confirm
Thank you Joachim :)
This works (as expected) fine :) with vB 4.01 and coppermine 1.4.25
(tested in a already installed version, not with the install function)
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: Joachim Müller on February 01, 2010, 05:50:06 pm
Phill,

did you have the chance to test the modified bridge file out?

Cheers

Joachim
Title: Re: Vbulletin 4.0 with cpg 1.4.25
Post by: phill104 on February 01, 2010, 09:44:05 pm
I've tried with vB3.8.4 and 4.01 and the bridge works as expected. Well done on adding it to 1.4.26 :)