[OBSOLETE] How to Integrate Coppermine with SMF

Started by dtm.exe, July 09, 2005, 04:59:26 PM

Previous topic - Next topic

CRCs Reality

Quote from: warhonowicz on September 06, 2006, 12:42:03 PM
button works fine, but the php script behind it doesn't ... damn

Hmmm, OK, I just did the upgrade, got the bridge working again, but now I'm in th same boat..  My button is still there but the script behind it does nothing.. This worked just before the upgrade...
warhonowicz , I see you got it working on your site, what was the issue?  Anybody?

DDT

I did a new upgrade of both SMF & Coppermine on another forum I have and it worked great, latest versions. No problems at all, but I still can't get the broken one to work (latest versions) so I must be missing a file somewhere  ::)

Existant

#302
Anyone know how to integrate it so it looks like this?

http://praetorianlegion.com/images/smfcm.jpg



skase98

How do you get users set up in Coppermine via the bridge?  I can see my memberlist but there is no settings area.  Consequently, none of my users can upload anything even though the Coppermine permissions are set up to allow registered users to do so.  When I look in the Coppermine users database, there is only one user (me).

I have bafflement.
Panic first, figure it out later

Holly

I am using Coppermine 1.4.10  Is there a code set to work with this one?

brianjd2

I originally posted this message on the Joomla forums. I thought this might help some of those on the SMF forums as well.
-----------------------------

I've been doing some work on integrating Coppermine into Joomla when configured with the Orstio bridge. I've got a working solution. It uses iframe, but it handles all direct URL redirects (using javascript), and integrates Coppermine Search into Joomla via a searchbot (or search mambot). I am providing this as is, but will try to elp out, if I can. I am also encouraging feedback and improvements. This solution works great for me, though it may not work for anyone else, I have tried to make it as universal as possible.

EDIT: Oh, and the mambot searches the title, caption, and keywords fields in the gallery. It checks permissions as well, both the primary group, and additional groups. It also allows full access for admins. If the logged-in user doesn't have access to the image, it doesn't show up in the search results.

Contents of Read Me file:

The Coppermine Searchbot tool requires some modifications to the Joomla! Wrapper component, and your Coppermine theme. These changes are to allow links to the direct (unwrapped) coppermine site to redirect correctly to a wrapped page. This is based on other code I have seen, but goes one step further in allowing alternate pages to also correctly redirect.


PREREQUISITES

Installed SMF 1.1.2
Installed Joomla 1.0.12
Installed Coppermine 1.4.10
Configured all Pieces Above
Created and functioning SMF-Joomla Bridge from Orstio on www.simplemachines.org
Created and functioning SMF-Coppermine Bridge (included in Coppermine package)


INSTRUCTIONS

Update the Joomla Wrapper component: /components/com_wrapper/wrapper.php
   The file included clearly shows where the code I added is from

This update will allow additional parameters to pass through to the iframe

Ensure the Menu Item for the Wrapper is configured correctly
   Wrapper Link should be to the directory of the Coppermine installation (eg. http://www....com/coppermine/)
   Published should be set to Yes
   Scroll Bars set to Auto (or the configuration screens won't work right)
   Auto Height set to Yes
   I also have Width and Height set to 100%, though these are not critical

Update your Coppermine Theme: /themes/(your theme)/template.html
   The file included clearly shows where the code I added is from

This update uses Javascript to determine if the coppermine gallery is loading in the Joomla wrapper (using an iframe) or not.

Update the coppermine location and the itemid in the template file, per the comments in the file.

Install the cpg_searchbot.zip file into Joomla. This is done through the admin tool as adding a mambot.

Configure the Site Mambots. Select the Search Coppermine mambot.

Publish the mambot, and enter your module name (which shows up in the search results), and the prefix for your coppermine tables (must be in same database).

Save it.


You are done!!



Please ask questions in the forum. I am providing this out of the goodness of my heart. I am releasing this under the GPL, and cannot guarantee support. It's free! I am providing this to all those with Joomla! SMF, and Coppermine looking to have an improved integration expereince.

Yeah, it's not perfect, but it works. And yeah, it's GPL... you want to modify it? Go ahead. It'd be really nice if you could share your improvements with the community. After all, that's really what this is about.

Thanks,
Brian Devendorf

Hmmm... I can't seem to post attachments. Oh well, get it here:
hxxp:www.brianjd.com/files/Coppermine_Searchbot.zip [nonactive]

Want to see a demo... try here:
hxxp:www.crookedcreekwi.org/ [nonactive]

mlquickel

#307
I am having a few what seems to be MINOR ISSUES!

Coppermine is showing on my SMF Forums perfectly, but it isn't logging in the users... I won't eb sure about the permissions till i can get users logged in and when i try and login to the gallery it self it send sme to my SMF Login and still don't work.

I will put up evrything i have done...

SMF Location = root/Hordies
CPG Location = root/Hgallery

I added a button into my forums which works perfectly that aint an issue.

Here is the complete code of both files that it said to edit.

I coudlnt find a smf.inc.php file in the bridge folder of CPG but i did find smf10.inc.php so here it is..

I italisized what i editted and Bolded anythign i think might be an issue. im nto runnin db server localhost.
also i coudl not find $path in there anwhere...

smf10.php

<?php
/*************************
 Coppermine Photo Gallery
 ************************
 Copyright (c) 2003-2006 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.10
 $Source$
 $Revision: 3275 $
 $Author: gaugau $
 $Date: 2006-09-03 12:10:47 +0200 (So, 03 Sep 2006) $
**********************************************/

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

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

require_once
'bridge/udb_base.inc.php';

if (!
USE_BRIDGEMGR) {
       require_once(
'../Hordies/SSI.php');
       
$boardurl = 'http://www.pwnzjoo.com/Hordies';
} else {
       require_once(
$BRIDGE['relative_path_to_config_file'] . 'SSI.php');
}


class
cpg_udb extends core_udb {

       function
cpg_udb()
       {
               global
$BRIDGE, $CONFIG, $boardurl, $db_prefix, $db_connection, $db_server, $db_name, $db_user, $user_settings;

               
$this->use_post_based_groups = $BRIDGE['use_post_based_groups'];
               
$this->boardurl = $boardurl;
               
$this->multigroups = 1;
               
$this->group_overrride = 1;


               
// Board table names
               
$this->table = array(
                       
'users' => 'members',
                       
'groups' => 'membergroups',
               );

               
// Database connection settings
               
$this->db = array(
                       
'name' => $db_name,
                     
'host' => $db_server ? $db_server : 'localhost',
                       
'user' => $db_user,
                       
'prefix' =>$db_prefix
               
);

       
// Derived full table names
       
if (strpos($db_prefix, '.') === false) {
           
$this->usertable = '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['users'];
           
$this->groupstable =  '`' . $this->db['name'] . '`.' . $this->db['prefix'] . $this->table['groups'];
       } else {
           
$this->usertable = $this->db['prefix'] . $this->table['users'];
           
$this->groupstable = $this->db['prefix'] . $this->table['groups'];
       }

               
// Table field names
               
$this->field = array(
                       
'username' => 'memberName', // name of 'username' field in users table
                       
'user_id' => 'ID_MEMBER', // name of 'id' field in users table
                       
'password' => 'passwd', // name of the password field in the users table
                       
'email' => 'emailAddress', // name of 'email' field in users table
                       
'regdate' => 'dateRegistered', // name of 'registered' field in users table
                       
'lastvisit' => 'UNIX_TIMESTAMP(lastLogin)', // last time user logged in
                       
'active' => 'is_activated', // is user account active?
                       
'location' => 'location', // name of 'location' field in users table
                       
'website' => 'websiteUrl', // name of 'website' field in users table
                       
'usertbl_group_id' => 'ID_POST_GROUP', // name of 'group id' field in users table
                       
'grouptbl_group_id' => 'ID_GROUP', // name of 'group id' field in groups table
                       
'grouptbl_group_name' => 'groupName' // name of 'group name' field in groups table
               
);

               
// Pages to redirect to
               
$this->page = array(
                       
'register' => '/index.php?action=register',
                       
'editusers' => '/index.php?action=mlist',
                       
'edituserprofile' => '/index.php?action=profile;u='
               
);

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

               
// Connect to db - or supply a connection id to be used instead of making own connection.
               
$this->connect($db_connection);
       }

       
// overriding authenticate() as we can let SMF do this all for us.
       
function authenticate()
       {
               global
$USER_DATA, $user_settings;

               if (!
$user_settings){
                       
$this->load_guest_data();
               } else {

                       
$row = array(
                               
'id' => $user_settings['ID_MEMBER'],
                               
'username' => $user_settings['memberName'],
                               
'group_id' => $user_settings['ID_GROUP']
                       );

                       
$this->load_user_data($row);
               }

               
$user_group_set = '(' . implode(',', $USER_DATA['groups']) . ')';

$USER_DATA = array_merge($USER_DATA, $this->get_user_data($USER_DATA['groups'][0], $USER_DATA['groups'], $this->guestgroup));

               
$USER_DATA['can_see_all_albums'] = $USER_DATA['has_admin_access'] = array_intersect($USER_DATA['groups'],$this->admingroups) ? 1 : 0;

               
// avoids a template error
               
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_groups($row)
       {
               global
$user_settings;

               
$i = $this->use_post_based_groups ? 100 : 0;
$data = array();

               if (
$user_settings['ID_GROUP'] == 0){
                       
$data[0] = 2;
               } else {
                       
$data[0] = $user_settings['ID_GROUP'] + $i;
               }

               if (
$user_settings['additionalGroups']){

                       
$groups = explode(',', $user_settings['additionalGroups']);

                       foreach (
$groups as $id => $group){
                                 
//$data[$id] = $group+$i; This was overwriting the primary group
                               
$data[] = $group+$i;  //appends additionalGroups to the primary group.
                       
}
               }

               if (
$this->use_post_based_groups) $data[] = $user_settings['ID_POST_GROUP'] + $i;

               return
$data;
       }

       function
collect_groups()
       {
               
// Use this version to exclude true post based groups
               //$sql ="SELECT * FROM {$this->groupstable} WHERE minposts=-1";

               // Use this version to include all SMF groups
               
$sql ="SELECT * FROM {$this->groupstable}";

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

               
$udb_groups = array(1=>'Guests', 2=>'Registered');

               while (
$row = mysql_fetch_assoc($result))
               {
                       
$udb_groups[$row[$this->field['grouptbl_group_id']]+100] = utf_ucfirst(utf_strtolower($row[$this->field['grouptbl_group_name']]));
               }

               return
$udb_groups;
       }

       function
login_page()
       {
               global
$CONFIG;

               
// silly workaround for SMF's redirect check...
               
$_SESSION['old_url'] = $CONFIG['site_url'] . '?board=redirect';
               
$this->redirect('/index.php?action=login');
       }

       function
logout_page()
       {
               global
$CONFIG;

               
// this is a wee bit messy like....
               
ob_start();
               
ssi_logout($CONFIG['site_url']);
               
preg_match('/<a href="(.*)">/', ob_get_clean(), $matches);
               
$this->boardurl = '';
       
$this->redirect($matches[1]);
       }

function view_users()
{
$this->redirect($this->page['editusers']);
}

function view_profile() {}
}


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


OK so upon looking it over again i foudn a spot in there that i think coudl be a problem but im asking before i edit. in the coge do u see where i have it Bolded my db serve ris NOT local host coudl that be an issue? Also please make sure i have everything else correct. I coudl NOT find $path in here anywhere so i figured it was at the italic areas.

Here is the code for the init.inc.php

I will Italisize what i editted and bold anythign i see as a potential problem.

init.inc.php

<?php
/*************************
 Coppermine Photo Gallery
 ************************
 Copyright (c) 2003-2006 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.10
 $Source$
 $Revision: 3275 $
 $Author: gaugau $
 $Date: 2006-09-03 12:10:47 +0200 (So, 03 Sep 2006) $
**********************************************/

define('COPPERMINE_VERSION', '1.4.10');
define('COPPERMINE_VERSION_STATUS', 'stable');

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

// Store all reported errors in the $cpgdebugger
require_once('include/debugger.inc.php');

set_magic_quotes_runtime(0);
// used for timing purpose
$query_stats = array();
$queries = array();

function
cpgGetMicroTime()
{
   list(
$usec, $sec) = explode(" ", microtime());
   return ((float)
$usec + (float)$sec);
}
$cpg_time_start = cpgGetMicroTime();
// Do some cleanup in GET, POST and cookie data and un-register global vars
$HTML_SUBST = array('&' => '&amp;', '"' => '&quot;', '<' => '&lt;', '>' => '&gt;', '%26' => '&amp;', '%22' => '&quot;', '%3C' => '&lt;', '%3E' => '&gt;','%27' => ''', "'" => ''');

$keysToSkip = array('_POST', '_GET', '_COOKIE', '_REQUEST', '_SERVER');

if (get_magic_quotes_gpc()) {
   if (is_array(
$_POST)) {
       foreach (
$_POST as $key => $value) {
           if (!is_array(
$value))
               
$_POST[$key] = strtr(stripslashes($value), $HTML_SUBST);
           if (!in_array(
$key, $keysToSkip) && isset($$key)) unset($$key);
       }
   }

   if (is_array(
$_GET)) {
       foreach (
$_GET as $key => $value) {
           unset(
$_GET[$key]);
           
$_GET[strtr(stripslashes($key), $HTML_SUBST)] = strtr(stripslashes($value), $HTML_SUBST);
           if (!in_array(
$key, $keysToSkip) && isset($$key)) unset($$key);
       }
   }

   if (is_array(
$_COOKIE)) {
       foreach (
$_COOKIE as $key => $value) {
           if (!is_array(
$value))
               
$_COOKIE[$key] = stripslashes($value);
           if (!in_array(
$key, $keysToSkip) && isset($$key)) unset($$key);
       }
   }
   if (is_array(
$_REQUEST)) {
       foreach (
$_REQUEST as $key => $value) {
           if (!is_array(
$value))
               
$_REQUEST[$key] = strtr(stripslashes($value), $HTML_SUBST);
           if (!in_array(
$key, $keysToSkip) && isset($$key)) unset($$key);
       }
   }
} else {
   if (is_array(
$_POST)) {
       foreach (
$_POST as $key => $value) {
           if (!is_array(
$value))
               
$_POST[$key] = strtr($value, $HTML_SUBST);
           if (!in_array(
$key, $keysToSkip) && isset($$key)) unset($$key);
       }
   }

   if (is_array(
$_GET)) {
       foreach (
$_GET as $key => $value) {
           unset(
$_GET[$key]);
           
$_GET[strtr(stripslashes($key), $HTML_SUBST)] = strtr(stripslashes($value), $HTML_SUBST);
           if (!in_array(
$key, $keysToSkip) && isset($$key)) unset($$key);
       }
   }

   if (is_array(
$_COOKIE)) {
       foreach (
$_COOKIE as $key => $value) {
           if (!in_array(
$key, $keysToSkip) && isset($$key)) unset($$key);
       }
   }
   if (is_array(
$_REQUEST)) {
       foreach (
$_REQUEST as $key => $value) {
           if (!is_array(
$value))
               
$_REQUEST[$key] = strtr($value, $HTML_SUBST);
           if (!in_array(
$key, $keysToSkip) && isset($$key)) unset($$key);
       }
   }
}
// Initialise the
$CONFIG array and some other variables
$CONFIG = array();
//
$PHP_SELF = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $_SERVER['SCRIPT_NAME'];

$PHP_SELF = '';
$ORIGINAL_PHP_SELF = $_SERVER['PHP_SELF'];
$possibilities = array('REDIRECT_URL', 'PHP_SELF', 'SCRIPT_URL', 'SCRIPT_NAME','SCRIPT_FILENAME');
foreach (
$possibilities as $test){
 if (isset(
$_SERVER[$test]) && preg_match('/([^\/]+\.php)$/', $_SERVER[$test], $matches)){
   
$PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'] = $matches[1];
   break;
 }
}

$REFERER = urlencode($_SERVER['PHP_SELF'] . (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : ''));
$ALBUM_SET = '';
$META_ALBUM_SET = '';
$FORBIDDEN_SET = '';
$FORBIDDEN_SET_DATA = array();
$CURRENT_CAT_NAME = '';
$CAT_LIST = '';
// Record User's IP address
$raw_ip = stripslashes($_SERVER['REMOTE_ADDR']);

if (isset(
$_SERVER['HTTP_CLIENT_IP'])) {
   
$hdr_ip = stripslashes($_SERVER['HTTP_CLIENT_IP']);
} else {
   if (isset(
$_SERVER['HTTP_X_FORWARDED_FOR'])) {
       
$hdr_ip = stripslashes($_SERVER['HTTP_X_FORWARDED_FOR']);
   } else {
       
$hdr_ip = $raw_ip;
   }
}

if (!preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/',
$raw_ip)) $raw_ip = '0.0.0.0';
if (!preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/',
$hdr_ip)) $hdr_ip = '0.0.0.0';

// Define some constants
define('USER_GAL_CAT', 1);
define('FIRST_USER_CAT', 10000);
define('RANDPOS_MAX_PIC', 200);
define('TEMPLATE_FILE', 'template.html');
// Constants used by the cpg_die function
define('INFORMATION', 1);
define('ERROR', 2);
define('CRITICAL_ERROR', 3);

// Include config and functions files
if(file_exists('include/config.inc.php')){
       ob_start();
       require_once 'include/config.inc.php';
       ob_clean();
} else {
 // error handling: if the config file doesn't exist go to install
 die('<html>
   <head>
     <title>Coppermine not installed yet</title>
     <meta http-equiv="
refresh" content="10;url=install.php">
     <style type="
text/css">
     <!--
     body { font-size: 12px; background: #FFFFFF; margin: 20%; color: black; font-family: verdana, arial, helvetica, sans-serif;}
     -->
     </style>
   </head>
   <body>
     <img src="
images/coppermine_logo.png" alt="Coppermine Photo Gallery - Your Online Photo Gallery" /><br />
     Coppermine Photo Gallery seems not to be installed correctly, or you are running coppermine for the first time. You\'ll be redirected to the installer. If your browser doesn\'t support redirect, click <a href="
install.php">here</a>.
   </body>
</html>');
}
$mb_utf8_regex = '[\xE1-\xEF][\x80-\xBF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xC2-\xDF][\x80-\xBF]';
require 'include/functions.inc.php';
# see http://php.net/mbstring for details
if (function_exists('mb_internal_encoding')) { mb_internal_encoding('UTF-8'); }

$CONFIG['TABLE_PICTURES']   = $CONFIG['TABLE_PREFIX'].'pictures';
$CONFIG['TABLE_ALBUMS']     = $CONFIG['TABLE_PREFIX'].'albums';
$CONFIG['TABLE_COMMENTS']   = $CONFIG['TABLE_PREFIX'].'comments';
$CONFIG['TABLE_CATEGORIES'] = $CONFIG['TABLE_PREFIX'].'categories';
$CONFIG['TABLE_CONFIG']     = $CONFIG['TABLE_PREFIX'].'config';
$CONFIG['TABLE_USERGROUPS'] = $CONFIG['TABLE_PREFIX'].'usergroups';
$CONFIG['TABLE_VOTES']      = $CONFIG['TABLE_PREFIX'].'votes';
$CONFIG['TABLE_USERS']      = $CONFIG['TABLE_PREFIX'].'users';
$CONFIG['TABLE_BANNED']     = $CONFIG['TABLE_PREFIX'].'banned';
$CONFIG['TABLE_EXIF']       = $CONFIG['TABLE_PREFIX'].'exif';
$CONFIG['TABLE_FILETYPES']  = $CONFIG['TABLE_PREFIX'].'filetypes';
$CONFIG['TABLE_ECARDS']     = $CONFIG['TABLE_PREFIX'].'ecards';
$CONFIG['TABLE_TEMPDATA']   = $CONFIG['TABLE_PREFIX'].'temp_data';
$CONFIG['TABLE_FAVPICS']    = $CONFIG['TABLE_PREFIX'].'favpics';
$CONFIG['TABLE_BRIDGE']     = $CONFIG['TABLE_PREFIX'].'bridge';
$CONFIG['TABLE_VOTE_STATS'] = $CONFIG['TABLE_PREFIX'].'vote_stats';
$CONFIG['TABLE_HIT_STATS']  = $CONFIG['TABLE_PREFIX'].'hit_stats';
// Connect to database
(
$CONFIG['LINK_ID'] = cpg_db_connect()) || die('<b>Coppermine critical error</b>:<br />Unable to connect to database !<br /><br />MySQL said: <b>' . mysql_error() . '</b>');
// Retrieve DB stored configuration
$results = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CONFIG']}");
while (
$row = mysql_fetch_array($results)) {
   
$CONFIG[$row['name']] = $row['value'];
} // while
mysql_free_result(
$results);

// Reference 'site_url' to 'ecards_more_pic_target'
$CONFIG['site_url'] =& $CONFIG['ecards_more_pic_target'];

// Include logger functions
include_once('include/logger.inc.php');

// Include media functions
require 'include/media.functions.inc.php';

// Check for GD GIF Create support
if (
$CONFIG['thumb_method'] == 'im' || function_exists('imagecreatefromgif'))
 
$CONFIG['GIF_support'] = 1;
else
 
$CONFIG['GIF_support'] = 0;

// Include plugin API
require('include/plugin_api.inc.php');
if (
$CONFIG['enable_plugins'] == 1) {
   CPGPluginAPI::load();
}

// Set UDB_INTEGRATION if enabled in admin
if (
$CONFIG['bridge_enable'] == 1 && !defined('BRIDGEMGR_PHP')) {
   
$BRIDGE = cpg_get_bridge_db_values();
} else {
 
$BRIDGE['short_name'] = 'coppermine';
 
$BRIDGE['use_standard_groups'] = 1;
 
$BRIDGE['recovery_logon_failures'] = 0;
 
$BRIDGE['use_post_based_groups'] = false;
}
//define('UDB_INTEGRATION',
$BRIDGE['short_name']);
define('UDB_INTEGRATION', 'smf10');

require_once 'bridge/' . UDB_INTEGRATION . '.inc.php';

/*

Removed temporarily due to non-compliance with bridging system - Nibbler

// Retrieve Array of Admin Groups (used for hiding admin usernames on thumbnails)
$results = cpg_db_query("SELECT group_id FROM {$CONFIG['TABLE_USERGROUPS']} WHERE has_admin_access ");
$CONFIG['ADMIN_GROUPS']=array();
while (
$row = mysql_fetch_array($results)) {
   
$CONFIG['ADMIN_GROUPS'][]= $row['group_id'];
} // while
mysql_free_result(
$results);

// Retrieve Array of Admin Users (used for hiding admin usernames on thumbnails)
$results = cpg_db_query("SELECT {$cpg_udb->field['user_id']} as user_id FROM $cpg_udb->usertable WHERE {$cpg_udb->field['usertbl_group_id']} in (" . implode(',',$CONFIG['ADMIN_GROUPS']).')');
$CONFIG['ADMIN_USERS']=array();
while (
$row = mysql_fetch_array($results)) {
   
$CONFIG['ADMIN_USERS'][] = $row['user_id'];
} // while
mysql_free_result(
$results);

*/

// Start output buffering
ob_start('cpg_filter_page_html');

// Parse cookie stored user profile
user_get_profile();

// Authenticate
$cpg_udb->authenticate();

// Test if admin mode
$USER['am'] = isset($USER['am']) ? (int)$USER['am'] : 0;
define('GALLERY_ADMIN_MODE', USER_IS_ADMIN &&
$USER['am']);
define('USER_ADMIN_MODE', USER_ID && USER_CAN_CREATE_ALBUMS &&
$USER['am'] && !GALLERY_ADMIN_MODE);


// Set error logging level
// Maze's new error report system
if (!USER_IS_ADMIN) {
   if (!
$CONFIG['debug_mode']) $cpgdebugger->stop(); // useless to run debugger cos there's no output
   error_reporting(E_PARSE); // hide all errors for visitors
}

// Process theme selection if present in URI or in user profile
if (!empty(
$_GET['theme'])) {
   
$USER['theme'] = $_GET['theme'];
}
// Load theme file
if (isset(
$USER['theme']) && !strstr($USER['theme'], '/') && is_dir('themes/' . $USER['theme'])) {
   
$CONFIG['theme'] = strtr($USER['theme'], '$/\\:*?"\'<>|`', '____________');
} else {
   unset(
$USER['theme']);
}

if (!
file_exists("themes/{$CONFIG['theme']}/theme.php")) $CONFIG['theme'] = 'classic';
require
"themes/{$CONFIG['theme']}/theme.php";
require
"include/themes.inc.php";  //All Fallback Theme Templates and Functions
$THEME_DIR = "themes/{$CONFIG['theme']}/";


// Process language selection if present in URI or in user profile or try
// autodetection if default charset is utf-8
if (!empty($_GET['lang']))
{
   
$USER['lang'] = ereg("^[a-z0-9_-]*$", $_GET['lang']) ? $_GET['lang'] : $CONFIG['lang'];
}

if (isset(
$USER['lang']) && !strstr($USER['lang'], '/') && file_exists('lang/' . $USER['lang'] . '.php'))
{
   
$CONFIG['default_lang'] = $CONFIG['lang'];          // Save default language
   
$CONFIG['lang'] = strtr($USER['lang'], '$/\\:*?"\'<>|`', '____________');
}
elseif (
$CONFIG['charset'] == 'utf-8')
{
   include(
'include/select_lang.inc.php');
   if (
file_exists('lang/' . $USER['lang'] . '.php'))
   {
       
$CONFIG['default_lang'] = $CONFIG['lang'];      // Save default language
       
$CONFIG['lang'] = $USER['lang'];
   }
}
else
{
   unset(
$USER['lang']);
}

if (isset(
$CONFIG['default_lang']) && ($CONFIG['default_lang']==$CONFIG['lang']))
{
       unset(
$CONFIG['default_lang']);
}

if (!
file_exists("lang/{$CONFIG['lang']}.php"))
 
$CONFIG['lang'] = 'english';

// We load the chosen language file
require "lang/{$CONFIG['lang']}.php";

// Include and process fallback here if lang <> english
if($CONFIG['lang'] != 'english' && $CONFIG['language_fallback']==1 ){
       require
"include/langfallback.inc.php";
}


// See if the fav cookie is set else set it
if (isset($_COOKIE[$CONFIG['cookie_name'] . '_fav'])) {
   
$FAVPICS = @unserialize(@base64_decode($_COOKIE[$CONFIG['cookie_name'] . '_fav']));
   foreach (
$FAVPICS as $key => $id ){
       
$FAVPICS[$key] = (int)$id; //protect against sql injection attacks
   
}
} else {
   
$FAVPICS = array();
}

// If the person is logged in get favs from DB those in the DB have precedence
if (USER_ID > 0){
       
$sql = "SELECT user_favpics FROM {$CONFIG['TABLE_FAVPICS']} WHERE user_id = ".USER_ID;
       
$results = cpg_db_query($sql);
       
$row = mysql_fetch_array($results);
       if (!empty(
$row['user_favpics'])){
               
$FAVPICS = @unserialize(@base64_decode($row['user_favpics']));
       }else{
               
$FAVPICS = array();
       }
}

/**
* CPGPluginAPI::action('page_start',null)
*
* Executes page_start action on all plugins
*
* @param null
* @return N/A
**/

CPGPluginAPI::action('page_start',null);

// load the main template
load_template();
// Remove expired bans
$now = date('Y-m-d H:i:s', localised_timestamp());

$CONFIG['template_loaded'] = true;

cpg_db_query("DELETE FROM {$CONFIG['TABLE_BANNED']} WHERE expiry < '$now'");
// Check if the user is banned
$user_id = USER_ID;
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_BANNED']} WHERE (ip_addr='$raw_ip' OR ip_addr='$hdr_ip' OR user_id=$user_id) AND brute_force=0");
if (
mysql_num_rows($result)) {
   
pageheader($lang_error);
   
msg_box($lang_info, $lang_errors['banned']);
   
pagefooter();
   exit;
}
mysql_free_result($result);
// Retrieve the "private" album set
if (!GALLERY_ADMIN_MODE && $CONFIG['allow_private_albums']) get_private_album_set();

if (!
USER_IS_ADMIN && $CONFIG['offline'] && !strstr($_SERVER["SCRIPT_NAME"],'login')) {
   
pageheader($lang_errors['offline_title']);
   
msg_box($lang_errors['offline_title'], $lang_errors['offline_text']);
   
pagefooter();
   exit;
}

// kick user into user_admin_mode (needed to fix "removed user mode for users" when upgrading)
if (USER_ID && !USER_IS_ADMIN && !$USER['am']) { // user is logged in, but is not gallery admin and not in admin mode
   
$USER['am'] = 1;
   
pageheader($lang_info, "<META http-equiv=\"refresh\" content=\"1;url=$referer\">");
   
msg_box($lang_info, 'Sending you to admin mode', $lang_continue, $referer);
   
pagefooter();
   
ob_end_flush();
   die();
}

?>


OK here the 1st line all i did was put a // in fornt of the original code and added the code below it and because it wasn't smf.php it was smf10.php i made it smf10 instead of smf.

please help me so i can move onto othe rissues im havin with SMF mods liek the Downloads mod saying im hacking when i try to download and other small cosmetic stuff.

Thank You!
Mike

majo

I dont know what gallery anymore lol........i think ill go with coppermine, can somebody tell me like is there any integration file or what do i need to do in order to have this all functioning ......with

1.1.2
TP 0.98

NeMoD

just install coppermine normally and go under the config and look for bridge manager, and tell it to use SMF, should work fine

majo

Sweet that worked ! , now how can i embend the coppermine into smf like so people don't use 2 addresess?

Powerbob

I have coppermine installed (via bridge manager) and it's working fine with smf  :D

The only thing I am having problems with is the link in the top menu. Yes I have looked at the manual etc but I am lost! Help would be great  :D


Bob



My SMF 2.1 Beta test site; http://www.pplb.net/smf21/index.php

SteveW

Watch the skies!!

CHwebby

Quote from: NeMoD on April 18, 2007, 09:03:08 PM
just install coppermine normally and go under the config and look for bridge manager, and tell it to use SMF, should work fine

I see no "bridge manager" in config

Ken.

It's the last item in the 'Admin Tools' menu.

CHwebby

oh DUH!  LOL I was looking under config thanx!

qubbah


chickenout

#317
I am having similar problems to what I have read in this thread.  I have a working SMF forum, 1.1.2 and a working coppermine gallery 1.4.10.
What I did was add a 'PHOTO' link in the forum menu and when clicked I would want the username to carry over to the photo page.
In these instructions there is no // define('UDB_INTEGRATION', 'smf'); in my init.inc.php file.
Here is what my file had:
// Set UDB_INTEGRATION if enabled in admin
if ($CONFIG['bridge_enable'] == 1 && !defined('BRIDGEMGR_PHP')) {
    $BRIDGE = cpg_get_bridge_db_values();
} else {
  $BRIDGE['short_name'] = 'coppermine';
  $BRIDGE['use_standard_groups'] = 1;
  $BRIDGE['recovery_logon_failures'] = 0;
  $BRIDGE['use_post_based_groups'] = false;
}

define('UDB_INTEGRATION', $BRIDGE['short_name']);

require_once 'bridge/' . UDB_INTEGRATION . 'coppermine.inc.php';


This was actually giving me errors by looking for copperminecoppermine.inc.php  I took out the short_name and it seems to working OK.

There has to be some kind of file alteration, but I'm kinda new with this.

Also, I don't have an smf.inc.php but I do have a smf10.inc.php and I see no $path line.

Any help would be greatly appreciated.
Thanks

Also, I ran the bridging wizard in the coppermine admin tools, but it didn't seem to make a difference.

alinne

Ok, I don't think I saw this already answered anywhere else so I'm going to ask it here. I am going to bridge my Coppermine gallery into my SMF forum but I want the gallery to match the forum. Is there a way to modify Coppermine to use the forum's theme, or perhaps to modify the SMF theme so that I can load it in Coppermine?

zap1206

Quote from: chickenout on May 09, 2007, 12:53:35 PM
Also, I ran the bridging wizard in the coppermine admin tools, but it didn't seem to make a difference.
The wizard worked for me. Be sure to activate the bridge (it's an option on the last page). It doesn't seem to sync the groups, but the users and login/logout are enough for me.


alinne : you can't directly. You will have to open a page on your forum, save it as HTML, and try to include parts of this HTML in a Coppermine theme.

Advertisement: