SMF and MediaWiki Bridge

Started by rsw686, February 08, 2008, 08:28:51 PM

Previous topic - Next topic

rngrdanny22

I've gotten the bridge to work properly! Thanks!

I just wish I could figure out how to blend it into my site like you did! :)

karl1990

This bridge does not do anything with auto authentication. It does allow you to specify a SMF group that is allowed to edit the wiki. Another plus is that it is a single file. The downside is the configuration does not use the values from SMF's Settings.php. You have to specify the database tables and permissions. It also doesn't set wiki sysop privileges for SMF administrators.

I did test this one out and found a small issue where they did not disable the change password option in the wiki. This only requires a change of true to false, which must have been an oversight. Neither of these two bridges check to make sure the users are activated and not banned before logging them in.

MultiformeIngegno

@karl1990: a chance that you make a new one....? :P
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Paracelsus

Quote from: karl1990 on April 02, 2010, 03:00:31 AM
This bridge does not do anything with auto authentication. It does allow you to specify a SMF group that is allowed to edit the wiki. Another plus is that it is a single file. The downside is the configuration does not use the values from SMF's Settings.php. You have to specify the database tables and permissions. It also doesn't set wiki sysop privileges for SMF administrators.

I did test this one out and found a small issue where they did not disable the change password option in the wiki. This only requires a change of true to false, which must have been an oversight. Neither of these two bridges check to make sure the users are activated and not banned before logging them in.

Actually in this bridge you can setup a SMF group as sysop and thus when you make changes to the group in SMF it reflects on the wiki sysop group. The reverse isn't possible unfortunately, meaning that you have to manually remove sysops from the group even if you already did it on the corresponding SMF group.

dbleeg

anybody have version 1.13 of this script?

The source is down:
hxxp:wgnrs.dynalias.com/smf/Auth_SMF.php [nonactive]

hxxp:www.mediawiki.org/wiki/Extension:SMF_Auth_Integration [nonactive]

and the last version that hxxp:archive.org [nonactive] has is 1.10:
hxxp:web.archive.org/web/*/http:/ [nonactive]/wgnrs.dynalias.com/smf/Auth_SMF.php

I've got it working but am experiencing the issues fixed in 1.11, 1.12 and 1.13.

MultiformeIngegno

DynaBonk I have it, unfortunately I'm not at home.... if you send me a pm I'll remember this and I'll send it to you.
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

kaiya

Quote from: karl1990 on April 02, 2010, 03:00:31 AM
This bridge does not do anything with auto authentication. It does allow you to specify a SMF group that is allowed to edit the wiki. Another plus is that it is a single file. The downside is the configuration does not use the values from SMF's Settings.php. You have to specify the database tables and permissions. It also doesn't set wiki sysop privileges for SMF administrators.

I did test this one out and found a small issue where they did not disable the change password option in the wiki. This only requires a change of true to false, which must have been an oversight. Neither of these two bridges check to make sure the users are activated and not banned before logging them in.
karl1990's post is a quote of rsw686's first post. The only bit that was karl1990 was "Neither of these two bridges check to make sure the users are activated and not banned before logging them in."

The download link worked fine for me just now.

Leemy

I get this error since going to 2.0 RC2

Unable to view external table.

mySQL error number: 0
mySQL error message:


I have already set the Auth SMF config to 2.0 instead of 1.0.  Any suggestions? Thanks!

Invers

Hello.
After hours of Googling, adding die('function name'); everywhere in the file. I managed to finally get that thing to work with SMF 2 RC3 and MediaWiki 1.15.3! Well at last it looks like that. Modded file is attached to this post.

The cause of trouble was that AutoAuthenticate Hook in MediaWiki was deprecated in version 1.13, so that Bridge wouldn't work with anything equal or higher than MediaWiki 1.13.
The solution was simple changing AutoAuthenticate Hook to UserLoadFromSession :)
My fix is ugly because I know almost nothing about media wiki nor SMF but at last it seems to work...
Logging in - works,
forum membergroups privileges on wiki, works too.

There are (at last) there things (I mean problems) left:
1. When trying to log out from Wiki, I get redirected to SMF and get
QuoteAn Error Has Occurred!
Session verification failed. Please try logging out and back in again, and then try again.
Any suggestion what happens here? For what should I go google tomorrow? :D

2. When I try to log in via wiki, I get redirected to SMF log-in panel, and after successful log-in, I'm not redirected back to wiki
Is that a bug, or is that SMF functionality restriction?

3. After logging out from SMF i stay logged in on wiki for a while... I think that's caused by nginx and my admins crazy cache settings...

If any one could test it on Mediawikis higher than 1.13 and report if there are any more problems left that would help because, I would spent my time just on Googling and trying to "fix" that... (it shouldn't matter if you use smf 1.1.11 or smf 2.0 just wiki have to be equal or higher than 1.13.0)


MultiformeIngegno

Invers I've reproduced the points 1) e 2)... and I've asked a solution the previous pages, but nothing.... :(
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Invers

#250
Ok I'll look at that, wish me a lucky Googling ^^"
About the 2) I think the problem is on SMF part (well actually I read somewhere, can't remember where, that SMF just can't do that, maybe rc3 can?)
About 1) I will dig in that tomorrow. Maybe I will manage to fix that with the power of almighty Google...


Oh, I forgot to ask yesterday...
MultiformeIngegno, I take that you didn't have problems like point 3?

nay27uk

Thanks for this bridge I have not read the hole thread here as it is 13 odd pages long. What I would like to know is if this will work if your forum is installed under another subdomain as I have installed some of the CMS bridges but never could get it to work just blank pages I was using the full paths to smf in the bridges i.e /vhosts/mydomain/subdomains/subdoain name/  ect. so befor I download this will it work like that with the wiki in one sub domain and the forum in another

Invers

nay27uk, I can't tell for sure, but it should work. Read the comments that is just above setting $wgCookieDomain in Auth_SMF.php
I think that's what you are looking for.

nay27uk

Quote from: Invers on May 22, 2010, 09:17:10 PM
nay27uk, I can't tell for sure, but it should work. Read the comments that is just above setting $wgCookieDomain in Auth_SMF.php
I think that's what you are looking for.

thankyou I have decided to move everuthing into my main root of the site and place them in seperat folders i.e mydomain.co.uk/forum mydomain.co.uk/wiki ect had to make this desition as I wanted to include the forum ect into the main site pages but with them being in sub domains this was proving extremley tricky to acomplish.

Succubus Evaligan

Any bridge who works fine with SMF 1.1.11 and MediaWiki 1.15.3?
Yuri Goddess

nay27uk

#255
I have a problem and wondered if you can help.

When I click on logout from the wiki and it takes me back to SMF I get this error displayed inside SMF

Quote
Unable to verify referring url. Please go back and try again.

Invers

@nay27uk
Well, I have same problem here... I was trying to figure something out, but because of high fever, I'm always giving up, and going back to my warm bed.


@Succubus Evaligan, depends what do you mean by "works fine", this one (not from first post, I attached a little modified version to one of my earlier post in this topic) basically works for smf 2.0rc3, it have some problems with log out via wiki, and redirecting back to wiki after login. everything else looks like works as it should. This bridge should work for SMF 1.1.11 as well... In the end, it looks like you will have to test it yourself.

nay27uk

ok not to worry I will only be allowing admins to edit the wiki anyway so its not to major thing.
I will closely monitor this thread and hope for a fix.

Thanks for the reply

Invers

#258
Hello, here is a fix for session verification fail.
Manual instruction:
go to line 329 Auth_SMF.php
you should see something like that:
function UserLogoutSMF(&$user) {
smf_sessionSetup();
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['rand_code']);
}


Change it to:

function UserLogoutSMF(&$user) {
smf_sessionSetup();
if(isset($_SESSION['session_value']))
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['session_value']);
else
smf_redirectWrapper('logout_url', 'logout;' . $_SESSION['session_var'] . '=' . $_SESSION['rand_code']);
}

After that, you shouldn't see any more "Session verification failed. Please try logging out and back in again, and then try again." error

For lazy people, I attached already modified Auth_SMF.php. but be careful because:
It wont work with mediawiki older than 1.13
I did not test it on smf 1.1.11
I was testing it on my setup which is SMF 2 RC3 and MediaWiki 1.15.3. Aside from not doing redirects from logout/login pages back to wiki, it was working fine for me.

So it would be great if someone with smf 1.1.11 tested it ^^

Now all that is left are redirects from login/logout/registration pages back to wiki. But... I have no idea how that works in smf and what is going on with that wiki extension...

----------

Here I will try to explain what was the cause of this ""Session verification failed. Please try logging out and back in again, and then try again." error :)
Look at this code.

function smf_sessionSetup() {
global $wgCookiePath;
// Clean out the existing session. This should have no affect
// since we are going to redirct the user to the SMF page.
session_destroy();
session_start();

// Load up the SMF session and set the redirect URL.
if(isset($_COOKIE['PHPSESSID']))
session_decode(smf_sessionRead($_COOKIE['PHPSESSID']));
// No exisiting session, create one
else
{
// Grab us a unique ID for SMF.
session_regenerate_id();

// Needed for SMF checks.
$_SESSION['rand_code'] = md5(session_id() . rand());
$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
die('rand code ='.$_SESSION['rand_code'].'');
$_COOKIE['PHPSESSID'] = session_id();
setcookie('PHPSESSID', session_id(), time() + 3600, $wgCookiePath, '', 0);
}
}

It looks like that if "if(isset($_COOKIE['PHPSESSID']))" returned true, then the variable $_SESSION['rand_code'], was never set anywhere, so logout function was using non-existent variable. therefore  after logout attempt from wiki all we saw was "Session verification failed. Please try logging out and back in again, and then try again."


MultiformeIngegno

@Invers: Thanks for your "wordaround", anyway for me it doesn't work... :(
I think it's caused by this:
http://dev.simplemachines.org/mantis/view.php?id=4244

In short: when you have a forum installed in a subdomain and then you call ssi.php (like here SMF_auth does) from ANOTHER subdomain (also if "enable indipendent cookies" is on) many of the integration functions don't work because of this session obfuscation bug! So you always receive a "session verification failed" or a "password wrong" error also if password is correct... :(
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Advertisement: