News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Different types of integration

Started by Orstio, February 21, 2005, 10:45:05 PM

Previous topic - Next topic

Orstio

Something that became apparent early on in the development of the Mambo-SMF bridge was the fact that different people wanted different things from what they saw as "intregration".  These can be classified into four main types:

1) Full integration.  SMF wrapped in mambo, single registration, single login, integrated features
2) Visual integration.  SMF wrapped in Mambo, but no shared member options.
3) Member integration.  SMF not wrapped in Mambo, but shared member options.
4) Shared registration, separate login.  Single registration, but separate logins, so that users can be better managed differently in Mambo and SMF.  This creates an environment where anyone can register, but the admin has control over which members can login to Mambo, and submit articles,links, documents, etc.

All four of these options are possible.  #1 is by far the most popular, followed by #3.  This is why the "unwrapped" option was put into the bridge config:  It still allows the functionality of #1, with the look of #3.  #2 is not terribly common, but some want it for continuity of their site theme.  They don't want/need anyone but the selected admin(s) to login to Mambo.  #4 is the least common, but it certainly has its merits in the right environment.

Are there any other combinations that people are using with the bridge?  More may be possible of which I am yet unaware.

[Unknown]

There are also cases in which one might want either wrapped or note wrapped, along with single side registration.

For example, maybe you only want (for whatever reason) people to register in Mambo.  No register button or anything for SMF... just login functionality (which may or may not be tied.)  The reverse is actually possible, too... you have to register at the forum (ie. to take advantage of its banning controls) and then you can log into Mambo.

These cases are by far less popular probably than the four you named, but they can be useful.  Not only when there are features, but more importantly when there are other integrations involved.  For example, say it was also integrated with osCommerce - it'd be nice to be able to use, instead of the registration component offered with the bridge, the one that works (without modification) for osCommerce - whether it be SMF or Mambo.

Another example is MediaWiki.  I've integrated it with SMF, and it allows for options that don't allow registration/login unless there's an account on the other side.  I was very impressed by this, because this was exactly what I wanted.

Obviously, the problem is password issues, but for those, there are things that can be done.  Obviously the login would still have to use the component.

There aren't that many other possible cases that make sense, though.

-[Unknown]

ChaosEnergy

Diiging an old topic...

But I searched for an SMF integration with MediaWiKi and only found this topic...so probably you can tell me how to do this

Thanks
Chaos Empire ®

TarantinoArchives

yes I also would be interested in this. Can you post a little tutorial on how to integrate mediwiki with SMF, or vice versa?

as with all integrations, i'd be interested on how such an integration would affect upgrading the one or the other

[Unknown]

I used an AuthPlugin, and only integrated logins.  It was a sinch with smf_api.php.

Then I created a MediaWiki skin and made it use SSI.php to load the layout.  Also fairly easy - same basic idea as in this topic:

Integrating the forum into your site...

-[Unknown]

TarantinoArchives

Quote from: [Unknown] on August 05, 2005, 10:13:13 AM
I used an AuthPlugin, and only integrated logins.  It was a sinch with smf_api.php.

can you explain a bit more?  ;)

[Unknown]

Look at includes/AuthPlugin.php.

-[Unknown]

TarantinoArchives

 :-[
that has more comments in it than actual code and i still dont really know what to do exactly.

so do i somehow tell mediawiki to use smf user database or vice versa? how will new mediawiki users register up? in the smf or in the mediawiki?

[Unknown]

They way I did it was so it only allowed people who are registered in SMF to log in.  They weren't even allowed to log in from the wiki, which is how I wanted it.

-[Unknown]

TarantinoArchives


TheFluffyOne

#10
Have just done a very quick bodge to do use SMF login details on a MediaWiki site. Seems to work OK, though I've only tested it for about 5 minutes...

AuthSMF.php
<?php
# AuthSMF.php
# SMF authentication plugin for MediaWiki
#
# Based on Blitzed authentication plugin by Mark Bergsma <mark at blitzed dot org>
#
# 20/08/2005 - Gordon Mckeown <sc_smfauth at thefluffyone dot net>

require_once( 'AuthPlugin.php' );

class 
AuthSMF extends AuthPlugin {
/* private */ var $smf_member_table;

function AuthSMF() {
$this->smf_member_table "`smf_ninjatest`.`smf_members`";
}

function encryptPassword$data$key ) {
        
$key str_pad(strlen($key) <= 64 $key pack('H*'md5($key)), 64chr(0x00));
        
return md5(($key str_repeat(chr(0x5c), 64)) . pack('H*'md5(($key str_repeat(chr(0x36), 64)). $data)));
}

function userExists$username ) {
$dbr =& wfGetDBDB_SLAVE );
$qUsername $dbr->addQuotes$username );

return $dbr->selectField(
$this->smf_member_table,
"ID_MEMBER",
"LCase(memberName)=LCase($qUsername)",
"AuthSMF::userExists" )
!== false;
}

function authenticate$username$password ) {
$dbr =& wfGetDBDB_SLAVE );
$qUsername $dbr->addQuotes$username );

$res $dbr->selectRow(
$this->smf_member_table,
"passwd",
"LCase(memberName)=LCase($qUsername)",
"AuthSMF::authenticate" );

if ( $res !== false )
return ($this->encryptPassword$passwordstrtolower($username) )
== $res->passwd);
else
return false;
}

function autoCreate() {
return true;
}

function strict() {
return true
}

function initUser( &$user ) {
$dbr =& wfGetDBDB_SLAVE );
$qUsername $dbr->addQuotes$user->mName );

$res $dbr->selectRow(
$this->smf_member_table,
array( "emailAddress""realName" ),
"LCase(memberName)=LCase($qUsername)",
"AuthSMF::initUser" );

if ( $res !== false ) {
$user->mEmail $res->emailAddress;
$user->mRealname $res->realName;
}
}

}

?>


You'll need to change "smf_ninjatest" to be your database name, and "smf_members" to be the name of the members table (usually "<prefix>members").

Then add to:

LocalSettings.php
require_once( "includes/AuthSMF.php" );
$wgAuth = new AuthSMF();

(Do this just after the
require_once( "includes/DefaultSettings.php" );
statement)

No guarantees it'll work well, if I get some time to do a proper job of it I'll post back here.


Edit: Oops. Had labelled the AuthSMF.php file incorrectly.

TarantinoArchives

cool.
also for other people a in-depth tutorial would surely be very helpful for the future i think

Andrew

I'd love to have something like this, but I just can't get it to work.  Mediawiki always tells me that the user does not exist.

tranzndance

It would be so cool if I could get this to work. :)

After entering the login info of my SMF admin into the wiki login page, I get this error message:
QuoteFatal error: Call to a member function on a non-object in C:\wamp\websites\tu2\wiki\includes\SpecialUserlogin.php on line 278
(this is a local test installation so I can't provide test login or link).

The error exists in this function:
/**
* @access private
*/
function processLogin() {
global $wgUser;

if ( '' == $this->mName ) {
$this->mainLoginForm( wfMsg( 'noname' ) );
return;
}
$u = User::newFromName( $this->mName );
if( is_null( $u ) ) {
$this->mainLoginForm( wfMsg( 'noname' ) );
return;
}
if ( 0 == $u->getID() ) {
global $wgAuth;
/**
* If the external authentication plugin allows it,
* automatically create a new account for users that
* are externally defined but have not yet logged in.
*/
if ( $wgAuth->autoCreate() && $wgAuth->userExists( $u->getName() ) ) {
if ( $wgAuth->authenticate( $u->getName(), $this->mPassword ) ) {
$u =& $this->initUser( $u );
} else {
$this->mainLoginForm( wfMsg( 'wrongpassword' ) );
return;
}
} else {
$this->mainLoginForm( wfMsg( 'nosuchuser', $u->getName() ) );
return;
}
} else {
$u->loadFromDatabase();
}
if (!$u->checkPassword( $this->mPassword )) {
$this->mainLoginForm( wfMsg( 'wrongpassword' ) );
return;
}


Specifically the last 'if' statement's first line.

Andrew

I wonder if my problem is that I have Mediawiki and SMF using different databases.

function AuthSMF() {
$this->smf_member_table = "`smf_ninjatest`.`smf_members`";
}


I set the corret names here, but I don't think I've ever defined a path to the right database.  How would I do that?  (I'm a php novice, so if this sounds like a simple question it may well be.)

Andrew

Now I'm just getting an error that the password is incorrect.  I can login to SMF fine, and Mediawiki seems to recognize the usernames (tried a couple), but not the password.  So close!

AbsoluteDestiny

I've been trying to get this to work with Mediawiki 1.5.2 and SMF 1.1 RC1 to no avail.

I read in another post that SMF 1.1 RC1 have changed their hashing from md5 to sha-1... If this is the case then is there any way to get this authorisation method to work?


Advertisement: