SMF Integration Methodology SMF Integration Methodology
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

SMF Integration Methodology

Started by [Unknown], September 13, 2004, 07:33:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[Unknown]

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:
<?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]

Joachim Müller

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)

kegobeer

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.  :)
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

#3
Ok...
I have integrate this code at the first part of smf.inc.php
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...

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

[Unknown]

Quote from: kegobeer on September 13, 2004, 01:50:30 PM
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.

QuoteMatter 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?

Quote from: Xavie_ McHot on September 13, 2004, 08:29:26 PM
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]

Joachim Müller

@[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

jack

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.
Please do not contact me for support directly - instead: post on this board!

spikeswife

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:
QuoteAn 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

Joachim Müller

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...

jack

#9
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)
Please do not contact me for support directly - instead: post on this board!

kegobeer

#10
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?
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

#11
Quote from: kegobeer on October 03, 2004, 10:08:54 PMUsing [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.

QuoteAlso, 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
Please do not contact me for support directly - instead: post on this board!

kegobeer

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


buglerroller

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

din1031

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 ;).

Hein Traag

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 ;)

bobaway

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.

Nibbler

Don't post support requests here, make your own thread. Don't be shy :)