Cannot Bridge with vbulletin Version 3.5.0 Cannot Bridge with vbulletin Version 3.5.0
 

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]

Main Menu

Cannot Bridge with vbulletin Version 3.5.0

Started by daklay, November 25, 2005, 06:50:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

daklay

I click on where it says "vbulletin 3.0" when i'm setting it up. When i hit enable, this comes up

QuoteCoppermine critical error:
Unable to connect to UDB database !

MySQL said:

These are the settings...

Forum URL:      http://www.titanshentai.com/forum
Relative path to your BBS's config file:    ../forum/
Use post-based groups?:    0


I had to go through the database itself and turn it off.
Help?

Nibbler

The vb 3.0 bridge file is not guaranteed to work with vb 3.5. Try specifying your database information manually in the bridge file:


// Database connection settings
$this->db = array(
'name' => $dbname,
'host' => $servername ? $servername : 'localhost',
'user' => $dbusername,
'password' => $dbpassword,
'prefix' =>$tableprefix
);

daklay

#2
Is there going to be a plugin to do that?

Joachim Müller

who knows? VB is not freeware, so it's hard for the coppermine devs to stay up-to-date with vb releases. We have to rely on people from the vb community to help us out. We've asked the vb people for a free copy in the past, just for being able to develop bridges, not for actually using the vb bbs live. However, they refused to do this. Might be a good idea to turn up on the vb support board and nag *hint*  ;).

daklay

Well, you can tell me what files you guys want from 3.5.0 and i can send them to you

Joachim Müller

no, you can't. The VB license doesn't allow you to give those files away, and we won't use illegal methods to accomplish this. We're open source developers, not pirates - we respect copyrights.

daklay

#6
Well, i'll talk to them about it

lierduh

The new Vbulletin bridge does not work with vB3.5(1). I don't think it will even work with vB3!

I have made some changes to make it work. The following notes might help the future developement of the vB bridge.

1) To verify an user through vB cookies.
You need:
$db_pass = md5($db_pass . COOKIE_SALT);
//$db_pass is the password string from user table

then

if ($db_pass === $_COOKIE['bbpassword'])

COOKIE_SALT is the vB license number. The 'Bridge wizard' might need to include an input to store the lincence number into bridge table.

2) DB variables in the config.php has changed. For vB3.5, they are:

$config['Database']['dbtype'] = 'mysql';

        //      ****** DATABASE NAME ******
        //      This is the name of the database where your vBulletin will be located.
        //      This must be created by your webhost.
$config['Database']['dbname'] = 'vbulletin';

        //      ****** TABLE PREFIX ******
        //      Prefix that your vBulletin tables have in the database.
$config['Database']['tableprefix'] = '';

        //      ****** TECHNICAL EMAIL ADDRESS ******
        //      If any database errors occur, they will be emailed to the address specified here.
        //      Leave this blank to not send any emails when there is a database error.
$config['Database']['technicalemail'] = 'webmaster@mysite';



        //      ****** MASTER DATABASE SERVER NAME ******
        //      This is the hostname or IP address of the database server.
        //      It is in the format HOST:PORT. If no PORT is specified, 3306 is used.
        //      If you are unsure of what to put here, leave it at the default value.
$config['MasterServer']['servername'] = 'localhost';

        //      ****** MASTER DATABASE USERNAME & PASSWORD ******
        //      This is the username and password you use to access MySQL.
        //      These must be obtained through your webhost.
$config['MasterServer']['username'] = 'dbuser';
$config['MasterServer']['password'] = 'dbpassword';

$config['Misc']['cookieprefix'] = 'bb';

So $this->db array needs to reflect this change.

3)
function load_user_data($row)
is broken with vB bridge.
To get it working quickly, one may need to change:

$this->multigroups = 1; to $this->multigroups = 0;
and turn off "use_post_based_groups".

Sorry, I can not contribute the full vB3.5 bridge. I made changes everywhere including udb_base.inc.php. If anything I will wait until next release when 'udb_base.inc.php' is more mature.

cdembek


MaxElc

Here is vb 3.5.0 -> CM 1.4.2 Bridge
Replace content of bridge/vbulletin30.inc.php with this code:
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.2
  $Source: /cvsroot/coppermine/devel/bridge/vbulletin30.inc.php,v $
  $Revision: 1.24 $
  $Author: gaugau $
  $Date: 2005/10/25 01:16:09 $
**********************************************/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

// Switch that allows overriding the bridge manager with hard-coded values
define('USE_BRIDGEMGR'1);

require 
'bridge/udb_base.inc.php';

class 
cpg_udb extends core_udb {

function cpg_udb()
{
global $BRIDGE;

if (!USE_BRIDGEMGR) {
$this->boardurl 'http://www.yousite.com/vb3';
require_once('../vb3/includes/config.php');

} else {
$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->multigroups 1;

// Database connection settings

if (isset($config['Database']['dbname']))
{
  // 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']
);
} else { echo "3.0.x";
  // Running on vBulletin 3.0.x
    $this->db = array(
     'name' => $dbname,
     'host' => $servername $servername 'localhost',
     'user' => $dbusername,
     'password' => $dbpassword,
     'prefix' =>$tableprefix
);
}

// Board table names
$this->table = array(
'users' => 'user',
'groups' => 'usergroup',
'sessions' => 'session'
);

// Derived full table names
$this->usertable '`' $this->db['name'] . '`.' $this->db['prefix'] . $this->table['users'];
$this->groupstable =  '`' $this->db['name'] . '`.' $this->db['prefix'] . $this->table['groups'];
$this->sessionstable =  '`' $this->db['name'] . '`.' $this->db['prefix'] . $this->table['sessions'];

// Table field names
$this->field = array(
'username' => 'username'// name of 'username' field in users table
'user_id' => 'userid'// name of 'id' field in users table
'password' => 'password'// name of 'password' field in users table
'email' => 'email'// name of 'email' field in users table
'regdate' => 'joindate'// name of 'registered' field in users table
'location' => "''"// name of 'location' field in users table
'website' => 'homepage'// name of 'website' field in users table
'usertbl_group_id' => 'usergroupid'// name of 'group id' field in users table
'grouptbl_group_id' => 'usergroupid'// name of 'group id' field in groups table
'grouptbl_group_name' => 'title' // name of 'group name' field in groups table
);

// Pages to redirect to
$this->page = array(
'register' => '/register.php',
'editusers' => '/memberlist.php',
'edituserprofile' => "/member.php?u=",
);

// Group ids - admin and guest only.
$this->admingroups = array(6);
$this->guestgroup $this->use_post_based_groups 101 3;

// Use a special function to collect groups for cpg groups table
$this->group_overrride 0;

// Cookie settings - used in following functions only
if (isset($config['Misc']['cookieprefix']))
{
  // get cookieprefix from vb3.5.x
  $this->cookie_name $config['Misc']['cookieprefix'];
} else {
  // get cookieprefix from vb3.0.x
  $this->cookie_name $cookieprefix;
}

// Connect to db
$this->connect();
}

// 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;
}
}
}

// Get groups of which user is member
function get_groups($row)
{
$data[0] = in_array($row['group_id'] - 100$this->admingroups) ? 2;

if ($this->use_post_based_groups){
$sql "SELECT g.{$this->field['usertbl_group_id']}+100 AS group_id, u.* FROM {$this->usertable} AS u, {$this->groupstable} as g WHERE g.{$this->field['grouptbl_group_id']} = u.{$this->field['usertbl_group_id']} AND u.{$this->field['user_id']} = '{$row['id']}'";

$result cpg_db_query($sql$this->link_id);
        
$row mysql_fetch_array($result);

$data[0] = $row['group_id'];

if ($row['membergroupids']){
$groups explode(','$row['membergroupids']);
foreach ($groups as $id => $group){
$data[] = $group+100;
}
}
}

return $data;
}

// definition of how to extract an id and password hash from a cookie
function cookie_extraction()
{
return false;
}

// definition of actions required to convert a password from user database form to cookie form
function udb_hash_db($password)
{
return $password// unused
}

function login_page()
{
$this->redirect("/index.php");
}

function logout_page()
{
$this->redirect("/login.php?do=logout&u=".USER_ID);
}
}

// and go !
$cpg_udb = new cpg_udb;
?>