Jump to content

Outdated coppermine bridge... mybb


iyeru42

Recommended Posts

I need help with correcting the following MyBB 1.4.1 partial Bridge...

<?php/*************************  Coppermine Photo Gallery  ************************  Copyright © 2003-2008 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 version 3  as published by the Free Software Foundation.    ********************************************  Coppermine version: 1.4.19  $HeadURL: [url="https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.4.x/bridge/mybb.inc.php"]https://coppermine.svn.sourceforge.net/svnr...ge/mybb.inc.php[/url] $  $Revision: 4392 $  $Author: gaugau $  $Date: 2008-04-16 09:25:35 +0200 (Mi, 16 Apr 2008) $**********************************************/if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');// Switch that allows overriding the bridge manager with hard-coded valuesdefine('USE_BRIDGEMGR', 1);require_once 'bridge/udb_base.inc.php';class cpg_udb extends core_udb {	function cpg_udb()	{		global $BRIDGE;				if (!USE_BRIDGEMGR) { // the vars that are used when bridgemgr is disabled			// URL of your punbb			$this->boardurl = 'http://localhost/mybb';			// local path to your punbb config file			require_once('../mybb/inc/config.php');						$this->use_post_based_groups = 1;		} else { // the vars from the bridgemgr			$this->boardurl = $BRIDGE['full_forum_url'];			require_once($BRIDGE['relative_path_to_config_file'] . 'config.php');			$this->use_post_based_groups = $BRIDGE['use_post_based_groups'];		}				$this->multigroups = 0;		$this->group_overrride = 0;				// Database connection settings		$this->db = array(			'name' => $config['database']['database'],			'host' => $config['database']['hostname'],			'user' => $config['database']['username'],			'password' => $config['database']['password'],			'prefix' =>$config['database']['table_prefix']		);				// Board table names		$this->table = array(			'users' => 'users',			'groups' => 'usergroups',			'sessions' => 'sessions',		);		// 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' => 'uid', // name of 'id' field in users table			'password' => 'loginkey', // name of 'password' field in users table			'email' => 'email', // name of 'email' field in users table			'regdate' => 'regdate', // name of 'registered' field in users table			'location' => "''", // name of 'location' field in users table			'website' => 'website', // name of 'website' field in users table			'usertbl_group_id' => 'usergroup', // name of 'group id' field in users table			'grouptbl_group_id' => 'gid', // 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' => '/member.php?action=register',			'editusers' => '/memberlist.php',			'edituserprofile' => "/member.php?action=profile&uid="		);				// Group ids		$this->admingroups = array(4);		$this->guestgroup = $this->use_post_based_groups ? 101 : 3;				// Connect to db		$this->connect();	}	// definition of how to extract id, name, group from a session cookie	function session_extraction()	{		if (!isset($_COOKIE['sid'])) return false;			$this->sid = addslashes($_COOKIE['sid']);				if (!$this->sid) return false;				$this->ipaddress = $this->getip();				$result = cpg_db_query("SELECT u.{$this->field['user_id']}, u.{$this->field['password']} FROM {$this->sessionstable} AS s INNER JOIN {$this->usertable} AS u ON u.uid = s.uid WHERE sid='".$this->sid."' AND ip='".$this->ipaddress."'", $this->link_id);				if (!mysql_num_rows($result)) return false;				$row = mysql_fetch_row($result);		return $row;	}		// definition of how to extract an id and password hash from a cookie	function cookie_extraction()	{		return  isset($_COOKIE['mybbuser']) ? array_map('addslashes', explode("_", $_COOKIE['mybbuser'], 2)) : false;	}		// imported function	function getip() {		if($_SERVER['HTTP_X_FORWARDED_FOR'])		{			if(preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_FORWARDED_FOR'], $addresses))			{				while(list($key, $val) = each($addresses[0]))				{					if(!preg_match("#^(10|172\.16|192\.168)\.#", $val))					{						$ip = $val;						break;					}				}			}		}		if(!$ip)		{			if($_SERVER['HTTP_CLIENT_IP'])			{				$ip = $_SERVER['HTTP_CLIENT_IP'];			}			else			{				$ip = $_SERVER['REMOTE_ADDR'];			}		}		return $ip;	}	// definition of actions required to convert a password from user database form to cookie form	function udb_hash_db($password)	{		return $password;	}		// Login	function login_page()	{		$this->redirect('/member.php?action=login');	}	// Logout	function logout_page()	{		$this->redirect('/member.php?action=logout&uid=' . USER_ID . '&sid=' . $this->sid);	}		function view_users()	{		if (!$this->use_post_based_groups) $this->redirect($this->page['editusers']);	}		function get_users($options = array())	{	}		function view_profile($uid)	{	}}// and go !$cpg_udb = new cpg_udb;?>

to work with the new MyBB 1.4.1 Config.php...

<?php/** * Database configuration * * Please see the MyBB Wiki for advanced * database configuration for larger installations * [url="http://wiki.mybboard.net/"]http://wiki.mybboard.net/[/url] */$config['database']['type'] = 'mysqli';$config['database']['database'] = '';$config['database']['table_prefix'] = 'mybb_';$config['database']['hostname'] = 'localhost';$config['database']['username'] = '';$config['database']['password'] = '';/** * Admin CP directory *  For security reasons, it is recommended you *  rename your Admin CP directory. You then need *  to adjust the value below to point to the *  new directory. */$config['admin_dir'] = 'admin';/** * Hide all Admin CP links *  If you wish to hide all Admin CP links *  on the front end of the board after *  renaming your Admin CP directory, set this *  to 1. */$config['hide_admin_links'] = 0;/** * Data-cache configuration *  The data cache is a temporary cache *  of the most commonly accessed data in MyBB. *  By default, the database is used to store this data. * *  If you wish to use the file system (cache/ directory), MemCache or eAccelerator *  you can change the value below to 'files', 'memcache' or 'eaccelerator' from 'db'. */$config['cache_store'] = 'db';/** * Memcache configuration *  If you are using memcache as your data-cache, *  you need to configure the hostname and port *  of your memcache server below. * * If not using memcache, ignore this section. */$config['memcache_host'] = 'localhost';$config['memcache_port'] = 11211;/** * Super Administrators *  A comma separated list of user IDs who cannot *  be edited, deleted or banned in the Admin CP. *  The administrator permissions for these users *  cannot be altered either. */$config['super_admins'] = '1';/** * Database Encoding *  If you wish to set an encoding for MyBB uncomment  *  the line below (if it isn't already) and change *  the current value to the mysql charset: *  [url="http://dev.mysql.com/doc/refman/5.1/en/charset-mysql.html"]http://dev.mysql.com/doc/refman/5.1/en/charset-mysql.html[/url] */$config['database']['encoding'] = 'utf8';/** * Automatic Log Pruning *  The MyBB task system can automatically prune *  various log files created by MyBB. *  To enable this functionality for the logs below, set the *  the number of days before each log should be pruned. *  If you set the value to 0, the logs will not be pruned. */$config['log_pruning'] = array(	'admin_logs' => 365, // Administrator logs	'mod_logs' => 365, // Moderator logs	'task_logs' => 30, // Scheduled task logs	'mail_logs' => 180, // Mail error logs	'user_mail_logs' => 180, // User mail logs	'promotion_logs' => 180 // Promotion logs); ?>

Also note, that a simple edit of the database config (in array $this->db) won't be the only thing that needs fixing. I cannot be logged in with my forum information for some reason. (You can also see the bad things that ensued from it.)Table structure of the mybb 1.4 if needed:

CREATE TABLE IF NOT EXISTS `mybb_usergroups` (  `gid` smallint(5) unsigned NOT NULL auto_increment,  `type` smallint(2) NOT NULL default '2',  `title` varchar(120) NOT NULL default '',  `description` text NOT NULL,  `namestyle` varchar(200) NOT NULL default '{username}',  `usertitle` varchar(120) NOT NULL default '',  `stars` smallint(4) NOT NULL default '0',  `starimage` varchar(120) NOT NULL default '',  `image` varchar(120) NOT NULL default '',  `disporder` smallint(6) unsigned NOT NULL,  `isbannedgroup` int(1) NOT NULL default '0',  `canview` int(1) NOT NULL default '0',  `canviewthreads` int(1) NOT NULL default '0',  `canviewprofiles` int(1) NOT NULL default '0',  `candlattachments` int(1) NOT NULL default '0',  `canpostthreads` int(1) NOT NULL default '0',  `canpostreplys` int(1) NOT NULL default '0',  `canpostattachments` int(1) NOT NULL default '0',  `canratethreads` int(1) NOT NULL default '0',  `caneditposts` int(1) NOT NULL default '0',  `candeleteposts` int(1) NOT NULL default '0',  `candeletethreads` int(1) NOT NULL default '0',  `caneditattachments` int(1) NOT NULL default '0',  `canpostpolls` int(1) NOT NULL default '0',  `canvotepolls` int(1) NOT NULL default '0',  `canusepms` int(1) NOT NULL default '0',  `cansendpms` int(1) NOT NULL default '0',  `cantrackpms` int(1) NOT NULL default '0',  `candenypmreceipts` int(1) NOT NULL default '0',  `pmquota` int(3) NOT NULL default '0',  `maxpmrecipients` int(4) NOT NULL default '5',  `cansendemail` int(1) NOT NULL default '0',  `maxemails` int(3) NOT NULL default '5',  `canviewmemberlist` int(1) NOT NULL default '0',  `canviewcalendar` int(1) NOT NULL default '0',  `canaddevents` int(1) NOT NULL default '0',  `canbypasseventmod` int(1) NOT NULL default '0',  `canmoderateevents` int(1) NOT NULL default '0',  `canviewonline` int(1) NOT NULL default '0',  `canviewwolinvis` int(1) NOT NULL default '0',  `canviewonlineips` int(1) NOT NULL default '0',  `cancp` int(1) NOT NULL default '0',  `issupermod` int(1) NOT NULL default '0',  `cansearch` int(1) NOT NULL default '0',  `canusercp` int(1) NOT NULL default '0',  `canuploadavatars` int(1) NOT NULL default '0',  `canratemembers` int(1) NOT NULL default '0',  `canchangename` int(1) NOT NULL default '0',  `showforumteam` int(1) NOT NULL default '0',  `usereputationsystem` int(1) NOT NULL default '0',  `cangivereputations` int(1) NOT NULL default '0',  `reputationpower` bigint(30) NOT NULL default '0',  `maxreputationsday` bigint(30) NOT NULL default '0',  `candisplaygroup` int(1) NOT NULL default '0',  `attachquota` bigint(30) NOT NULL default '0',  `cancustomtitle` int(1) NOT NULL default '0',  `canwarnusers` int(1) NOT NULL default '0',  `canreceivewarnings` int(1) NOT NULL default '0',  `maxwarningsday` int(3) NOT NULL default '3',  `canmodcp` int(1) NOT NULL default '0',  PRIMARY KEY  (`gid`)) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=8;CREATE TABLE IF NOT EXISTS `mybb_users` (  `uid` int(10) unsigned NOT NULL auto_increment,  `username` varchar(120) NOT NULL default '',  `password` varchar(120) NOT NULL default '',  `salt` varchar(10) NOT NULL default '',  `loginkey` varchar(50) NOT NULL default '',  `email` varchar(220) NOT NULL default '',  `postnum` int(10) NOT NULL default '0',  `avatar` varchar(200) NOT NULL default '',  `avatardimensions` varchar(10) NOT NULL default '',  `avatartype` varchar(10) NOT NULL default '0',  `usergroup` smallint(5) unsigned NOT NULL default '0',  `additionalgroups` varchar(200) NOT NULL default '',  `displaygroup` smallint(5) unsigned NOT NULL default '0',  `usertitle` varchar(250) NOT NULL default '',  `regdate` bigint(30) NOT NULL default '0',  `lastactive` bigint(30) NOT NULL default '0',  `lastvisit` bigint(30) NOT NULL default '0',  `lastpost` bigint(30) NOT NULL default '0',  `website` varchar(200) NOT NULL default '',  `icq` varchar(10) NOT NULL default '',  `aim` varchar(50) NOT NULL default '',  `yahoo` varchar(50) NOT NULL default '',  `msn` varchar(75) NOT NULL default '',  `birthday` varchar(15) NOT NULL default '',  `birthdayprivacy` varchar(4) NOT NULL default 'all',  `signature` text NOT NULL,  `allownotices` int(1) NOT NULL default '0',  `hideemail` int(1) NOT NULL default '0',  `subscriptionmethod` int(1) NOT NULL default '0',  `invisible` int(1) NOT NULL default '0',  `receivepms` int(1) NOT NULL default '0',  `pmnotice` int(1) NOT NULL default '0',  `pmnotify` int(1) NOT NULL default '0',  `remember` int(1) NOT NULL default '0',  `threadmode` varchar(8) NOT NULL default '',  `showsigs` int(1) NOT NULL default '0',  `showavatars` int(1) NOT NULL default '0',  `showquickreply` int(1) NOT NULL default '0',  `showredirect` int(1) NOT NULL default '0',  `ppp` smallint(6) NOT NULL default '0',  `tpp` smallint(6) NOT NULL default '0',  `daysprune` smallint(6) NOT NULL default '0',  `dateformat` varchar(4) NOT NULL default '',  `timeformat` varchar(4) NOT NULL default '',  `timezone` varchar(4) NOT NULL default '',  `dst` int(1) NOT NULL default '0',  `dstcorrection` int(1) NOT NULL default '0',  `buddylist` text NOT NULL,  `ignorelist` text NOT NULL,  `style` smallint(5) unsigned NOT NULL default '0',  `away` int(1) NOT NULL default '0',  `awaydate` int(10) unsigned NOT NULL default '0',  `returndate` varchar(15) NOT NULL default '',  `awayreason` varchar(200) NOT NULL default '',  `pmfolders` text NOT NULL,  `notepad` text NOT NULL,  `referrer` int(10) unsigned NOT NULL default '0',  `reputation` bigint(30) NOT NULL default '0',  `regip` varchar(50) NOT NULL default '',  `lastip` varchar(50) NOT NULL default '',  `longregip` int(10) NOT NULL default '0',  `longlastip` int(10) NOT NULL default '0',  `language` varchar(50) NOT NULL default '',  `timeonline` bigint(30) NOT NULL default '0',  `showcodebuttons` int(1) NOT NULL default '1',  `totalpms` int(10) NOT NULL default '0',  `unreadpms` int(10) NOT NULL default '0',  `warningpoints` int(3) NOT NULL default '0',  `moderateposts` int(1) NOT NULL default '0',  `moderationtime` bigint(30) NOT NULL default '0',  `suspendposting` int(1) NOT NULL default '0',  `suspensiontime` bigint(30) NOT NULL default '0',  `coppauser` int(1) NOT NULL default '0',  `classicpostbit` int(1) NOT NULL default '0',  PRIMARY KEY  (`uid`),  UNIQUE KEY `username` (`username`),  KEY `usergroup` (`usergroup`),  KEY `birthday` (`birthday`)) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2;CREATE TABLE IF NOT EXISTS `mybb_sessions` (  `sid` varchar(32) NOT NULL default '',  `uid` int(10) unsigned NOT NULL default '0',  `ip` varchar(40) NOT NULL default '',  `time` bigint(30) NOT NULL default '0',  `location` varchar(150) NOT NULL default '',  `useragent` varchar(100) NOT NULL default '',  `anonymous` int(1) NOT NULL default '0',  `nopermission` int(1) NOT NULL default '0',  `location1` int(10) NOT NULL default '0',  `location2` int(10) NOT NULL default '0',  `loginattempts` tinyint(2) NOT NULL default '1',  `failedlogin` bigint(30) NOT NULL default '0',  PRIMARY KEY  (`sid`),  KEY `location1` (`location1`),  KEY `location2` (`location2`),  KEY `time` (`time`),  KEY `uid` (`uid`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...