[BETA] Coppermine Photo Gallery Bridge

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Ideas Centre
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Coppermine Photo Gallery Bridge

Post by ckwalsh »

Alright, I put together a new bridge that seems to be much more stable and I think should work for everyone. I'll get it uploaded somewhere tomorrow, as I need to get some sleep right now. The new version supports real permissions though the ACP.
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
Arcon1112
Registered User
Posts: 20
Joined: Fri May 27, 2005 9:06 am

Re: [BETA] Coppermine Photo Gallery Bridge

Post by Arcon1112 »

great thx brainy...sleep well and code good :twisted:

Lg Arcon
Das schwierige beim Katz- und Mausspiel ist zu wissen wer die Katze ist!
azzurri
Registered User
Posts: 909
Joined: Fri Jul 21, 2006 7:48 pm

Re: [BETA] Coppermine Photo Gallery Bridge

Post by azzurri »

Brainy wrote:Alright, I put together a new bridge that seems to be much more stable and I think should work for everyone. I'll get it uploaded somewhere tomorrow, as I need to get some sleep right now. The new version supports real permissions though the ACP.
Oh my God, you are my hero. Cant wait to try this out!!
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Coppermine Photo Gallery Bridge

Post by ckwalsh »

I'm going to make this into a real MOD package, but here it is for now :P. Please tell me if there are any problems with installation.

COPY root/phpbb3.inc.php TO coppermine_root/bridge/phpbb3.inc.php
phpbb3.inc.php:

Code: Select all

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2007 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.12
  $Source$
  $Revision: 3636 $
  $Author: gaugau $
  $Date: 2007-06-29 11:35:30 +0200 (Fr, 29 Jun 2007) $
**********************************************/

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

$user_temp = $user;
define('IN_PHPBB', true);
$phpbb_root_path = '../../forum';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$phpbb_user = $user;
$user = $user_temp;

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

require_once 'bridge/udb_base.inc.php';

class phpbb3_udb extends core_udb {

	function phpbb3_udb()
	{
		global $BRIDGE;

		// If your board is hosted on another subdomain, you need to manually set this
		// This should contain the path to your phpBB3 installation, including folders and "http://"
		$this->boardurl = generate_board_url();
		// ***EXAMPLE OVERRIDE***
		// $this->boardurl = "http://phpbb3.example.com";
		
		$this->use_post_based_groups = false;
		$this->multigroups = 1;
		$this->group_overrride = 1;
		
		// Connect to db
		//$this->connect();
	}

	function collect_groups()
	{
		global $db;
		
		$sql ="SELECT * FROM " . GROUPS_TABLE;
	
		$result = $db->sql_query($sql);
		
		$udb_groups = array(1 =>'Administrators', 2=> 'Registered', 3=>'Guests', 4=> 'Banned');
			
		while ($row = $db->sql_fetchrow($result))
		{
			$udb_groups[$row[$this->field['grouptbl_group_id']]+100] = utf_ucfirst(utf_strtolower($row['group_name']));
		}
		return $udb_groups;
		
	}
	// definition of how to extract id, name, group from a session cookie
	function session_extraction()
	{
		global $phpbb_user;
	
		if($phpbb_user->data['user_id'] == ANONYMOUS) return false;
		return array($phpbb_user->data['user_id'], $phpbb_user->data['password']);
	}
	
	// Get groups of which user is member
	function get_groups($row)
	{
		global $db;
	
		$data = array(1);
		
		$sql = "SELECT ug.group_id+100 AS group_id FROM " . USERS_TABLE . " AS u, " . USER_GROUP_TABLE . " AS ug, " . GROUPS_TABLE . " as g WHERE u.user_id=ug.user_id AND u.user_id='{$row['id']}' AND g.group_id = ug.group_id";

		$result = $db->sql_query($sql);

		while ($row = $db->sql_fetchrow($result))
		{
			$data[] = $row['group_id'];
		}
		
		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("/ucp.php?mode=login");
	}

	function logout_page()
	{
		global $phpbb_user;
		$this->redirect("/ucp.php?mode=logout&sid={$phpbb_user->data['session_id']}");
	}

	function view_users() {}
	function view_profile() {}
	
	function get_users($options = array())
	{
		return array();
	}
	function authenticate()
    {
		global $phpbb_user, $USER_DATA, $auth;
		if($phpbb_user->data['user_id'] == ANONYMOUS)
		{
			$this->load_guest_data();
		}
		else
		{
			$this->load_user_data(array('id' => $phpbb_user->data['user_id'], 'username' => $phpbb_user->data['username']));
		}
		
		$user_group_set = '(' . implode(',', $USER_DATA['groups']) . ')';
		
		$USER_DATA = array_merge($USER_DATA, $this->get_user_data(2, $USER_DATA['groups'], $this->guestgroup));
		$USER_DATA['has_admin_access'] = (!$auth->acl_get('a_photos'))?0:1;
		$USER_DATA['can_see_all_albums'] = $USER_DATA['has_admin_access'];
		// avoids a template error apparently
            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']);

        $this->session_update();
	}
	function get_user_count()
	{
		global $db;
		static $user_count = 0;

		if (!$user_count)
		{
		$result = $db->sql_query("SELECT count(*) FROM ".USERS_TABLE." WHERE 1");
		$nbEnr = $db->sql_fetchrow($result);
		$user_count = $nbEnr[0];
		mysql_free_result($result);
		}
	}
}

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

Code: Select all

INSERT INTO phpbb_acl_options (auth_option, is_global, is_local, founder_only) VALUES ('a_photos', 1, 0, 0);
OPEN coppermine_root/include/functions.inc.php

FIND

Code: Select all

/**
* Coppermine Photo Gallery - functions.inc.php
BEFORE, ADD

Code: Select all

define("IS_PHPBB_BRIDGED", true);
FIND

Code: Select all

function make_clickable($text)
BEFORE, ADD

Code: Select all

if(!defined("IS_PHPBB_BRIDGED") || !IS_PHPBB_BRIDGED)
{
FIND

Code: Select all

// Allow the use of a limited set of phpBB bb codes in albums and image descriptions
// Taken from phpBB code
BEFORE, ADD

Code: Select all

}
DIY

Code: Select all

At the beginning of the phpbb3.inc.php file you must edit the $phpbb_root_path variable to point to your phpBB3 installation from the bridge.  If you don't edit it, it probably won't work.  Once you have completed all file edits and SQL, you must clear your cache from the phpBB3 ACP control panel.  Finally, go into coppermine and enable the bridge.
Last edited by ckwalsh on Mon Dec 10, 2007 8:07 pm, edited 1 time in total.
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
azzurri
Registered User
Posts: 909
Joined: Fri Jul 21, 2006 7:48 pm

Re: [BETA] Coppermine Photo Gallery Bridge

Post by azzurri »

I get an error in coppermine
Parse error: syntax error, unexpected T_FUNCTION in /include/functions.inc.php on line 558
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Coppermine Photo Gallery Bridge

Post by ckwalsh »

azzurri wrote:I get an error in coppermine
Parse error: syntax error, unexpected T_FUNCTION in /include/functions.inc.php on line 558
I did a stupid when copying/pasting. I've updated above, but this should fix it if you followed the instructions exactly.

OPEN coppermine_root/include/functions.inc.php

FIND

Code: Select all

if(!defined("IS_PHPBB_BRIDGED") || !IS_PHPBB_BRIDGED)
// Allow the use of a limited set of phpBB bb codes in albums and image descriptions
// Taken from phpBB code
REPLACE WITH

Code: Select all

}
// Allow the use of a limited set of phpBB bb codes in albums and image descriptions
// Taken from phpBB code
Overall, you should have added an if statement at hte top of that function and a closing bracket at the bottom.
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
azzurri
Registered User
Posts: 909
Joined: Fri Jul 21, 2006 7:48 pm

Re: [BETA] Coppermine Photo Gallery Bridge

Post by azzurri »

Great, that fixed that problem...but now I got another one after activating the bridge itself
Fatal error: Call to a member function session_begin() on a non-object in bridge/phpbb3.inc.php on line 25
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Coppermine Photo Gallery Bridge

Post by ckwalsh »

Did you edit the $phpbb_root_path variable so it points to your forum?
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
azzurri
Registered User
Posts: 909
Joined: Fri Jul 21, 2006 7:48 pm

Re: [BETA] Coppermine Photo Gallery Bridge

Post by azzurri »

I tried all kinds of versions, but nothing changes. I have my forum installed like this

root/forum
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Coppermine Photo Gallery Bridge

Post by ckwalsh »

Hmmm... That is the only reason I can think of that would cause that.

Where is your folder located in relation to your forum?

Is the site you are working with connected to the internet? Could I look at your setup?
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
WappyRS
Registered User
Posts: 4
Joined: Tue Dec 11, 2007 12:40 am

Re: [BETA] Coppermine Photo Gallery Bridge

Post by WappyRS »

yeah iam getting the exact same error as above too
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Coppermine Photo Gallery Bridge

Post by ckwalsh »

When you are putting in the root path, are you putting it in relative to the bridge file?

If it is not working, you might want to try using the absolute path of the phpBB3 installation.
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
WappyRS
Registered User
Posts: 4
Joined: Tue Dec 11, 2007 12:40 am

Re: [BETA] Coppermine Photo Gallery Bridge

Post by WappyRS »

i sort that error out by emptying the bridge sql table data but now it does bridge it but users cant see the albums and if you look on users list critical error User table is empty !
azzurri
Registered User
Posts: 909
Joined: Fri Jul 21, 2006 7:48 pm

Re: [BETA] Coppermine Photo Gallery Bridge

Post by azzurri »

Brainy wrote:When you are putting in the root path, are you putting it in relative to the bridge file?

If it is not working, you might want to try using the absolute path of the phpBB3 installation.
I tried that too. I think I have tried every possible alternative. Always the same error.

I have it set up like this...

root/forum
root/coppermine

I have tried
../../forum
../forum
./forum
../forum/
../forum/
../../forum/
http://www.mysite.com/forum
/mysite/forum
/public_html/forum

and on and on...but still exact same error.
azzurri
Registered User
Posts: 909
Joined: Fri Jul 21, 2006 7:48 pm

Re: [BETA] Coppermine Photo Gallery Bridge

Post by azzurri »

WappyRS wrote:i sort that error out by emptying the bridge sql table data but now it does bridge it but users cant see the albums and if you look on users list critical error User table is empty !
Didnt work for me. Instead I got a different error...
Fatal error: require_once() [function.require]: Failed opening required 'bridge/.inc.php' (include_path='.:/usr/local/share/pear') in /coppermine/include/init.inc.php on line 239
When I edit that line to say phpbb3.inc.php I got back the old error message.
Locked

Return to “[3.0.x] MODs in Development”