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]