Advanced search  

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]

Pages: [1]   Go Down

Author Topic: SMF Integration Methodology  (Read 34074 times)

0 Members and 1 Guest are viewing this topic.

[Unknown]

  • VIP
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • Simple Machines
SMF Integration Methodology
« on: September 13, 2004, 07:33:17 am »

As I posted at simplemachines.org, I've finally released a tool for integrating software into SMF.  I think this should solve many of the problems associated with integration currently.

I know that currently, one of the barriers is licensing.  SMF is not released under the GPL, and so including ("linking") SMF with it is a problem.  Further, SMF uses the function "db_query" - but Coppermine uses a function with the same name that takes different parameters.  I wrote this tool specifically to solve these issues.

First off, we seem to have received approval from our lawyer to release this under many licenses.  I would like to speak with the people here directly on this topic, but I believe this can be resolved easily.  As well, all the functions and variables used in this tool are prefixed with "smf_" - meaning, no more conflicts.

This alone could make the smf.inc.php file a lot cleaner and more efficient.

A few of the other problems facing the current bridge are logout, login redirection, and database usage.  These can also be solved with smf_api.php.

The logout problem is most likely caused by either $_SESSION['rand_code'] not being set yet, or the session being stored in the database.  The smf_api.php tool allows you to access the database session data (although, that must be used to store session data...), and stores this code in $GLOBALS['smf_user_info']['session_id'].

Login redirection also seems resolved by the current bridge - except one very critical problem.  The session, again, is often stored in the database - so this does not, in fact, pass the login_url properly unless it is stored in the correct session data.  Again, this is easily solved with smf_api.php.

Database usage is practically a non-problem with this tool as well.  The prefix is only available as `database_name`.prefix_, through $smf_settings['db_prefix'].  This will always access the correct database, assuming the user being used has access to it.  To solve this problem, the function smf_query may be used to ensure that the correct connection is used to access the database.  As long as no joins are used between SMF and Coppermine, this should mean that the bridge can be used with two different databases.

An example usage of smf_api.php would be as follows:
Code: [Select]
<?php

require_once('smf_api.php');

smf_authenticateUser();
smf_loadSession();

// Optionally.  Passing 'coppermine' to the function (also optional) will make SMF act as if you went to ?action=coppermine - allowing for this action to be shown in the who's online listing.
smf_logOnline('coppermine');

?>

The tool can also be used to directly set the login cookie, with no help from SMF or any redirection.  This may or may not be ideal for integration. (I would think so, but I'm not totally familiar with your integration system.)

As well, smf_api.php can be included in a function or anywhere, without flaw.  SMF does not have to be defined when using it, and generally it should just be better in every way for integration.

If you have any suggestions on how it could be improved, I would be very happy to hear them.  A detailed listing of the functions and variables provided by it are available near the top of the file - comments on that are welcome to.

Thanks - I hope this can be used to improve both SMF and Coppermine,
-[Unknown]
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: SMF Integration Methodology
« Reply #1 on: September 13, 2004, 09:58:44 am »

This is excellent news - hopefully Jack (who wrote the SMF and YaBB SE bridges) will find the time to look into this (I'll notify him in case he isn't monitoring this thread).
The duplicate function names in coppermine and SMF have been ironed out for the current coppermine devel version as well, using a similar approach: kegobeer changed the function names to be more unique ("cpg_db_query" instead of "db_query" etc.). The next version of coppermine should then be able to benefit from SMF's ssi.php as well (e.g. on Coppermine's anycontent.php that can be used to include dynamic content from non-coppermine pages).

I'll sticky this topic, hopefully there will be an announcement soon that the session issues have been settled ;-)

Joachim (aka GauGau)
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: SMF Integration Methodology
« Reply #2 on: September 13, 2004, 01:50:30 pm »

The sessions issues have been fixed with the variable changes and function renames.  Matter of fact, SSI.php is enabled automatically when using the SMF bridge.  :)
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Xavie_ McHot

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: SMF Integration Methodology
« Reply #3 on: September 13, 2004, 08:29:26 pm »

Ok...
I have integrate this code at the first part of smf.inc.php
Code: [Select]
require_once('../forum/smf_api.php');

smf_authenticateUser();
smf_loadSession();
smf_logOnline('coppermine');
The logout run correctly, but i have some error on the page...
Code: [Select]
Notice: Constant ¨Ōë 6 already defined in /home/httpd/vhosts/gothic-culture.net/httpdocs/gallery/bridge/smf.inc.php on line 85

Notice: A session had already been started - ignoring session_start() in /home/httpd/vhosts/gothic-culture.net/httpdocs/gallery/bridge/smf.inc.php on line 154

Fatal error: Call to undefined function: db_affected_rows() in /home/httpd/vhosts/gothic-culture.net/httpdocs/forum/smf_api.php on line 591

Warning: Unknown(): A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0
« Last Edit: September 13, 2004, 08:52:15 pm by Xavie_ McHot »
Logged

[Unknown]

  • VIP
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 18
    • Simple Machines
Re: SMF Integration Methodology
« Reply #4 on: September 14, 2004, 07:12:09 am »

The sessions issues have been fixed with the variable changes and function renames.

Not quite.  At least in the current download, 1.3.2, you're still using the method of "manually" including in files which does not use the database session method.  It's possible you could turn this off and still have logout work, but many have it on - as it is the default.

Quote
Matter of fact, SSI.php is enabled automatically when using the SMF bridge.  :)

Not in the one available for download right now, at least.  Are you certain?

Ok...
I have integrate this code at the first part of smf.inc.php

You can't just add to smf.inc.php - it has to be changed and partially rewritten.  It already loads a session, and defines SMF, all things it should no longer be doing if using smf_api.php.

-[Unknown]
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: SMF Integration Methodology
« Reply #5 on: September 14, 2004, 08:46:09 am »

@[Unknown]: kegobeer wasn't refering to the current release, but the devel version that hasn't been packaged up yet, you can get it from the web cvs: http://cvs.sourceforge.net/viewcvs.py/coppermine/devel/bridge/smf.inc.php?rev=1.24&view=log (I'm not sure though this cpg1.4 bridge file will work on a cpg1.3.x install, but you should get the idea).

@Xavie_ McHot: This thread is actually not a "usual" support thread. It's about future versions of SMF and CPG, nothing you could use with your existing install, unless you know your way around and are able to modify/fix things for you, sorry. Please give us a bit more time to figure this out, we'll post a solution for everybody once it's ready.

Joachim
Logged

jack

  • VIP
  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 279
Re: SMF Integration Methodology
« Reply #6 on: September 23, 2004, 01:14:58 pm »

Hi Guys,
After a far too long hiatus (and an absoultely hellish exam earlier in the week), I'm back on the case :)

Currently pulling down the latest dev code & will be starting work to see if I can get something knocked up by this evening ;)

At first glance, this doesn't look too dissimilar to the API code that Unknown gave me a few months ago, hopefully it will only require minor changes to what I had written against that.
Logged
Please do not contact me for support directly - instead: post on this board!

spikeswife

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 18
  • Romans 1:16
    • Scrapbooking Resource Center
Re: SMF Integration Methodology
« Reply #7 on: September 25, 2004, 07:42:55 am »

I'm not quite certain how the integration of CPG and SMF is supposed to go, but mine hasn't been quite as described in either the docs or on the support forum.

First, I didn't lose any uploads.  Is that possible?  Second, am I supposed to be able to use the CPG Admin interface when viewing users?  I can't - it takes me directly to my SMF users list.  Finally, I can't log out from CPG.  I get the following error:
Quote
An Error Has Occurred!
Unable to verify referring url. Please go back and try again.

Can someone tell me if I've done something incorrectly and, if so, what?  I've read and re-read everything I can find on the support forum related to this issue and I've read through the docs several times to double-check that I've done everything asked but I feel as if I've missed something.

Thank you, in advance, for your help with this and thank you for your patience with me.

Gina
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: SMF Integration Methodology
« Reply #8 on: September 25, 2004, 08:09:46 am »

the answer given in http://forum.coppermine-gallery.net/index.php?topic=9934.msg44729#msg44729 to Xavie applies to you as well: this thread deals with new means of integration that haven't been implemented yet, it's basically developer's talk here. No support given on this thread. It's expected behaviour that when bridged you're being sent to your BBS app's user management, as coppermine doesn't use it's own user management when bridged, but the one from your bridged application. Nobody said you'd lose any uploads when integrating, you just lose the correlation between the users who uploaded the files and the "new" users from the bbs. The logout issue you're experiencing is what is being discussed on this thread, it's a known issue and yet awaits a solution. Please do not reply to this thread, but use the search to find more detailed answers to your questions and post in another (new) thread.

Joachim

P.S. We have a "one question per thread" policy...
Logged

jack

  • VIP
  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 279
Re: SMF Integration Methodology
« Reply #9 on: October 03, 2004, 09:39:12 pm »

I have now added an smf-api.inc.php

Obviously, you will need to download the smf_api.php file from www.simplemachines.org and put it in the folder that SMF is installed in.

Caveat :
The SMF db and the CPG db must be on the same server and accessible with the same username & password. I'm currently assuming that that is the case.

Due to the lack of info about database access provided by the api file, I'm trying to think of the most efficient way of determining wether you can link tables. I think I will have to do so by trying a db query, but I'd like something less kludgey.

Oh, and the logout problem is still there :-[

Fixed after commiting my current version of the code, ::)

BTW, it has been committed in the 1.4 devel branch (just noticed that this thread is in the 1.3 forum)
« Last Edit: October 03, 2004, 09:49:16 pm by jack »
Logged
Please do not contact me for support directly - instead: post on this board!

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: SMF Integration Methodology
« Reply #10 on: October 03, 2004, 10:08:54 pm »

Jack,

Using [Unknown]'s api, is it now possible to have separate databases?  That's what I assumed after playing with it.  Thanks for working on the SMF bridge, BTW!

Also, in the devel, I see that smf.inc.php is still there, with smf-api.inc.php added.  Should the original be deleted/renamed and replaced with yours?
« Last Edit: October 03, 2004, 10:30:08 pm by kegobeer »
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

jack

  • VIP
  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 279
Re: SMF Integration Methodology
« Reply #11 on: October 03, 2004, 10:58:38 pm »

Using [Unknown]'s api, is it now possible to have separate databases? That's what I assumed after playing with it. Thanks for working on the SMF bridge, BTW!

It's certainly possible to have seperate databases, but at the moment, I'm going to say that they must be on the same server and both accessible with the same mysql username & password.

Quote
Also, in the devel, I see that smf.inc.php is still there, with smf-api.inc.php added. Should the original be deleted/renamed and replaced with yours?

I suppose that eventually that will be possible, but definately not now. This commit is the first version that appears to work correctly ;)
Also, it hasn't been integrated into the bridgemanager yet, and there's a couple of new features I want to add too :)

People are just gonna love what happens when you click on login/logout now ;D
« Last Edit: October 03, 2004, 11:42:49 pm by jack »
Logged
Please do not contact me for support directly - instead: post on this board!

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: SMF Integration Methodology
« Reply #12 on: October 04, 2004, 12:35:10 am »

Sweet!  I can't wait, Jack!
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: SMF Integration Methodology
« Reply #13 on: October 11, 2004, 01:06:20 pm »

Me either.  :-*
Logged

buglerroller

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: SMF Integration Methodology
« Reply #14 on: October 19, 2004, 10:49:44 pm »

smf, mos and cpg are all working together with users integrated. next is osc!! argg
http://www.talbotautos.com
Logged

din1031

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: SMF Integration Methodology
« Reply #15 on: April 16, 2005, 02:48:11 pm »

Shit, why did i see this thread not early... i rewite the smf bridge so i can use the theme changes of the forum... but now i see... there is a easier way... how ever it work now but for the next Version i use this ;).
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: SMF Integration Methodology
« Reply #16 on: August 08, 2005, 06:17:35 pm »

Looks like im going to keep my eye on this thread. I did suceed to merge the two but batch ad is giving problems. Thanks for the work dev people ;)
Logged

bobaway

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: SMF Integration Methodology
« Reply #17 on: November 09, 2005, 07:46:09 pm »

Hi all, I am a newbie to both Coppermine and SMF and having a little trouble integrating them.  It seems so far that all works except that this message appears at the top of my Coppermine forum:

Notice: Undefined index: 10.0.6.38 in /home/content/m/y/f/myfieldstone/html/coppermine/bridge/smf.inc.php on line 560

Any help would be greatly appreciated.
Logged

Nibbler

  • Guest
Re: SMF Integration Methodology
« Reply #18 on: November 09, 2005, 08:12:09 pm »

Don't post support requests here, make your own thread. Don't be shy :)
Logged
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 19 queries.