PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2006-04-12 20:34:23

Jansson
Former Administrator
From: Sweden
Registered: 2005-04-24
Posts: 431
Website

Thoughts regarding the wiki

For a long time I've been bothered about the current wiki system here at PunRes. I personally don't like it very much nor the way it works. In the planning for the next PunRes version there is a new wiki system. I've been thinking of doing my own system based on PunBB. However, I've grown very fond of the MediaWiki and I've been thinking about migrating to this wiki system instead and put it on wiki.punres.net. In the next version of PunRes I've focused alot on navigation and the way you are using PunRes, this will integrate the wiki even more into the use of PunRes. Even though MediaWiki doesn't look anything like PunRes I think it would still be possible to in a way integrate it in the way you use PunRes. I was thinking of something like how PunBB.org have integrated the forums. Because today, even though there's a link to the wiki and it looks very much like PunBB, it doesn't feel like you're still on PunRes and I think very few people use it and contribute. Also, all the problems the current system have caused have made me look elsewhere for a wiki system.

Anyway, I would like to know what you, the people who use PunRes think about this. If we decide to migrate, this would happen before the arrive of the next PunRes version.


Thank you for your time


// Jansson

PunRes developer | Blog
Winbas Affärssystem

Offline

 

#2 2006-04-12 20:40:40

elbekko
Moderator
From: Leuven, Belgium
Registered: 2006-01-31
Posts: 1353

Re: Thoughts regarding the wiki

I'd love to see a MediaWiki instead smile
Also, you can easily skin it smile So just make it look like PunBB would be easy. Using the logins is impossible though I think.

What would own is that wehn you create a project, you automatically create a wiki page for it (like the thread system now)


FluxBB
dictionary.com on programming: The most fun you can have with your clothes on (although clothes are not mandatory).

Offline

 

#3 2006-04-12 20:53:05

Jansson
Former Administrator
From: Sweden
Registered: 2005-04-24
Posts: 431
Website

Re: Thoughts regarding the wiki

Actually, integrating the user database should be very easy. I will have to investigate further.


// Jansson

PunRes developer | Blog
Winbas Affärssystem

Offline

 

#4 2006-04-12 21:27:26

elbekko
Moderator
From: Leuven, Belgium
Registered: 2006-01-31
Posts: 1353

Re: Thoughts regarding the wiki

I have a MediaWiki on my local test server. This is what the user table looks like:

Code:

user_id       
user_name       
user_real_name       
user_password       
user_newpassword       
user_email       
user_options       
user_touched       
user_token       
user_email_authenticated       
user_email_token       
user_email_token_expires

1     
Elbekko     
El Bekko     
[BLOB - 32 Bytes]     
[BLOB - 0 Bytes]     
elbekko@gmail.com     
[BLOB - 844 Bytes]     
20051030164045     
9452abc940f9680d62aa5fd3b0730883     
NULL     
44e3a924a56bbe4c660086c032fea4e8     
20051106163040

if you compare that to PunBB's system, it's quite different =/


FluxBB
dictionary.com on programming: The most fun you can have with your clothes on (although clothes are not mandatory).

Offline

 

#5 2006-04-12 22:36:17

Jansson
Former Administrator
From: Sweden
Registered: 2005-04-24
Posts: 431
Website

Re: Thoughts regarding the wiki

I just logged into mediawiki with my PunRes account. Here's how it works:

There is a class in mediawiki called AuthPlugin. You make a subclass of this one and tell mediawiki to use it. Whenever you login mediawiki check with this class if you are able to login or not (check against PunRes user db). To solve the compatibility issue, mediawiki still keeps its own user database and the first time you login it creates a new row for your user. Now I only need to remove the register functions and some user preferences and redirect that to punres, then mod the profile.php to update a few columns in the mediawiki usertable to reflect the changes, such as real_name and email.


// Jansson

PunRes developer | Blog
Winbas Affärssystem

Offline

 

#6 2006-04-12 22:50:17

elbekko
Moderator
From: Leuven, Belgium
Registered: 2006-01-31
Posts: 1353

Re: Thoughts regarding the wiki

Handy smile


FluxBB
dictionary.com on programming: The most fun you can have with your clothes on (although clothes are not mandatory).

Offline

 

#7 2006-04-12 23:55:19

Jansson
Former Administrator
From: Sweden
Registered: 2005-04-24
Posts: 431
Website

Re: Thoughts regarding the wiki

Just a heads up, the authentication integration is finished now and it's working excellent smile


// Jansson

PunRes developer | Blog
Winbas Affärssystem

Offline

 

#8 2006-05-03 12:46:02

FxPatrice
New member
From: France
Registered: 2006-05-03
Posts: 2

Re: Thoughts regarding the wiki

Jansson wrote:

Just a heads up, the authentication integration is finished now and it's working excellent smile

Hi

Is your MOD for the authentication integration of Mediawiki with PunBB user's available on PunRes ?
I don't find it ...

It will be very usefull for me.

Thank you by advance

Offline

 

#9 2006-05-03 15:14:08

Jansson
Former Administrator
From: Sweden
Registered: 2005-04-24
Posts: 431
Website

Re: Thoughts regarding the wiki

Nope, I plan on putting it on the wiki, but I'm not completely finished with it yet.


// Jansson

PunRes developer | Blog
Winbas Affärssystem

Offline

 

#10 2006-05-03 17:20:19

FxPatrice
New member
From: France
Registered: 2006-05-03
Posts: 2

Re: Thoughts regarding the wiki

Thanks, I would wait... smile ... impatiently wink

Offline

 

#11 2006-05-11 13:08:48

AlanCollier
New member
Registered: 2006-05-11
Posts: 9

Re: Thoughts regarding the wiki

I'd also appreciate instructions on how to integrate punBB and MediaWiki.

Thanks

--Alan

Offline

 

#12 2006-05-12 02:58:06

bradleyb
New member
Registered: 2006-05-10
Posts: 5

Re: Thoughts regarding the wiki

Jansson wrote:

I just logged into mediawiki with my PunRes account. Here's how it works:

There is a class in mediawiki called AuthPlugin. You make a subclass of this one and tell mediawiki to use it. Whenever you login mediawiki check with this class if you are able to login or not (check against PunRes user db). To solve the compatibility issue, mediawiki still keeps its own user database and the first time you login it creates a new row for your user. Now I only need to remove the register functions and some user preferences and redirect that to punres, then mod the profile.php to update a few columns in the mediawiki usertable to reflect the changes, such as real_name and email.

Actually I think it's even easier than that. I added this to LocalSettings.php:

Code:

# Expire cookie at end of session
$wgCookieExpiration = 0;
$wgDisableCookieCheck = true;


#punbb integration

define('PUN_QUIET_VISIT', 1);
define('PUN_ROOT', '/usr/local/webspace/punbb/');
require PUN_ROOT.'include/common.php';

$wgHooks['AutoAuthenticate'][] = 'AutoAuthenticatePunBB';

function AutoAuthenticatePunBB(&$user) {
        global $pun_user;

        if ($pun_user['is_guest']) {
                return new User();
        }

        $user = User::newFromName($pun_user['username']);
        if ( $user->getID() == 0 ) {
                $user->addToDatabase();
                $user->setToken();
                $user->setRealName($pun_user['realname']);
                $user->setEmail($pun_user['email']);
                $user->confirmEmail();
                if ($pun_user['g_id'] == PUN_ADMIN) {
                        $user->addGroup("sysop");
                }
        } else {
                /* Should cache some day, I guess :) */
                $user->loadFromDatabase();
        }
        return true;
}

The cookie settings make sure you don't stay logged into the wiki when you log out of PunBB, and the rest is a hook that gets called from Setup.php.

I adapted it from http://mail.wikipedia.org/pipermail/med … 09508.html
I just whipped it up today, so hopefully there are no major problems with it...

Last edited by bradleyb (2006-05-12 10:34:13)

Offline

 

#13 2006-05-12 03:48:22

bradleyb
New member
Registered: 2006-05-10
Posts: 5

Re: Thoughts regarding the wiki

Here's some more stuff I added. These also go into LocalSettings.php

Code:

#Don't allow anonymous creation of accounts from wiki
$wgGroupPermissions['*'    ]['createaccount']   = false;

#Redirect the Login/Logout links
$wgHooks['UserLogout'][] = 'UserLogoutPunBB';
$wgHooks['UserLoginForm'][] = 'UserLoginFormPunBB';

function UserLogoutPunBB(&$user) {
        global $pun_user;

        redirect('/forums/login.php?action=out&id='.$pun_user['id'], 'Logging out. Redirecting …');
}

function UserLoginFormPunBB(&$template) {
        redirect('/forums/login.php/?redirect_url='.$_SERVER['HTTP_REFERER'], 'Logging in. Redirecting …');
}

The redirect stuff is kind of hairy, you will probably have to modify punbb's login.php to get the "redirect_url" to work correctly.
You may also want to replace redirect() with header(Location: ...) to make it more seamless for the user.

Last edited by bradleyb (2006-05-12 11:08:08)

Offline

 

#14 2006-05-23 22:33:35

AlanCollier
New member
Registered: 2006-05-11
Posts: 9

Re: Thoughts regarding the wiki

Jansson

Are you working on that wiki article on how you integrated of Mediawiki with PunBB?
I'm looking to do the same and would like to know how you did it.

Thanks

--Alan

Offline

 

#15 2006-05-25 19:04:51

saiyr
Guest

Re: Thoughts regarding the wiki

bradleyb wrote:

...

This seemed to work out pretty well for me.  Like said, adjustments have to be made to make redirect_url work for logging in.  In addition, instead of placing everything in LocalSettings.php, I went ahead and split it off to an extension, putting "include( "extensions/PunBBAuth.php" );" in LocalSettings and placing the below in extensions/PunBBAuth.php:

Code:

<?php
# PunBB WikiMedia extension

if( !defined( 'MEDIAWIKI' ) )
die();

$wgExtensionCredits['other'][] = array(
    'name' => 'PunBB Authentication',
    'description' => '[Hopefully] authenticates using PunBB database',
    'author' => 'Bradley B'
);

# Expire cookie at end of session
$wgCookieExpiration = 0;
$wgDisableCookieCheck = true;


#punbb integration

define('PUN_QUIET_VISIT', 1);
define('PUN_ROOT', '/path/to/forum/');
require PUN_ROOT.'include/common.php';

$wgHooks['AutoAuthenticate'][] = 'AutoAuthenticatePunBB';

function AutoAuthenticatePunBB(&$user) {
    global $pun_user;

    if ($pun_user['is_guest']) {
        return new User();
    }

    $user = User::newFromName($pun_user['username']);
    if ( $user->getID() == 0 ) {
        $user->addToDatabase();
        $user->setToken();
        $user->setRealName($pun_user['realname']);
        $user->setEmail($pun_user['email']);
        $user->confirmEmail();
        if ($pun_user['g_id'] == PUN_ADMIN) {
            $user->addGroup("sysop");
        }
    } else {
        /* Should cache some day, I guess :) */
        $user->loadFromDatabase();
    }
    return true;
}

#Don't allow anonymous creation of accounts from wiki
$wgGroupPermissions['*'    ]['createaccount']   = false;

#Redirect the Login/Logout links
$wgHooks['UserLogout'][] = 'UserLogoutPunBB';
$wgHooks['UserLoginForm'][] = 'UserLoginFormPunBB';

function UserLogoutPunBB(&$user) {
    global $pun_user;

    header( 'Location:  http://link/to/forum/login.php?action=out&redirect_url=http://link/to/wiki&id='.$pun_user['id'] );
}

function UserLoginFormPunBB(&$template) {
    header( 'Location:  http://link/to/forum/login.php?redirect_url='.$_SERVER['HTTP_REFERER'] );
}

?>

I changed a little bit of login.php for my PunBB install as well.  At the bottom of the else if ($action == 'out'), I changed the redirect to:

Code:

    $redirector = isset($_REQUEST['redirect_url']) ? $_REQUEST['redirect_url'] : 'index.php';
    redirect($redirector, $lang_login['Logout redirect']);

Around line 195 you see $redirect_url.  Change that to:

Code:

$redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : isset($_REQUEST['redirect_url']) ? $_REQUEST['redirect_url'] : 'index.php';

The only problem I came across (which drove me nuts) was that my browser kept caching the wiki index, so when you logged out, it still looked like you were logged in, but if you clicked elsewhere, it showed that you were logged out.  Clearing the cache didn't help, since it just recached the logged out version.

 

#16 2006-05-25 19:20:16

Jansson
Former Administrator
From: Sweden
Registered: 2005-04-24
Posts: 431
Website

Re: Thoughts regarding the wiki

AlanCollier wrote:

Jansson

Are you working on that wiki article on how you integrated of Mediawiki with PunBB?
I'm looking to do the same and would like to know how you did it.

Thanks

--Alan

That will have to wait a 2-3 weeks since I simply doesn't have time to do that atm. sad

If you can't wait, you might want to try out the other solutions posted in this thread.


// Jansson

PunRes developer | Blog
Winbas Affärssystem

Offline

 

#17 2006-06-19 14:23:17

vara
New member
Registered: 2006-06-18
Posts: 2

Re: Thoughts regarding the wiki

im also interested in a mediawiki/punbb user integration hack

Offline

 

#18 2006-08-19 11:44:27

teenagegluesniffer
Guest

Re: Thoughts regarding the wiki

Yea, I am also very interested in this.

 

#19 2006-08-25 03:17:52

snoogly
Guest

Re: Thoughts regarding the wiki

Any news on this mod?

 

#20 2006-09-17 07:44:37

tgs
New member
Registered: 2006-09-12
Posts: 5

Re: Thoughts regarding the wiki

So is there any update on this?

Offline

 

#21 2006-10-25 10:59:56

tdh
New member
Registered: 2006-04-21
Posts: 6

Re: Thoughts regarding the wiki

Chipping in to keep this alive: any news here? smile

Offline

 

#22 2006-12-13 05:19:22

bradleyb
New member
Registered: 2006-05-10
Posts: 5

Re: Thoughts regarding the wiki

I upgraded to MediaWiki 1.8.x (was using 1.6.x before), and found that my extension did not work anymore. I made some changes and it works well once again:

Add this to LocalSettings.php:

Code:

include( "extensions/PunBBAuth.php" );

extensions/PunBBAuth.php:

Code:

<?php
# PunBB MediaWiki extension

if( !defined( 'MEDIAWIKI' ) )
die();

$wgExtensionCredits['other'][] = array(
    'name' => 'PunBB Authentication',
    'description' => 'Auto-authenticates the current PunBB user',
    'author' => 'Bradley Bell'
);


# PunBB integration

//define('PUN_QUIET_VISIT', 1);
define('PUN_ROOT', '/path/to/punbb/');
require PUN_ROOT.'include/common.php';

$wgHooks['AutoAuthenticate'][] = 'AutoAuthenticatePunBB';
$wgHooks['UserLogout'][] = 'UserLogoutPunBB';
$wgHooks['UserLoginForm'][] = 'UserLoginFormPunBB';

function AutoAuthenticatePunBB(&$user) {
        global $pun_user;

        if ($pun_user['is_guest']) {
                return true;
        }

        $user->setName($pun_user['username']);
        $user->setId($user->idFromName($pun_user['username']));
        if ( $user->getID() == 0 ) {
                $user->addToDatabase();
                $user->setToken();
                $user->setRealName($pun_user['realname']);
                $user->setEmail($pun_user['email']);
                $user->confirmEmail();
                if ($pun_user['g_id'] == PUN_ADMIN) {
                        $user->addGroup("sysop");
                }
        } else {
                /* Should cache some day, I guess :) */
                $user->loadFromDatabase();
                $user->setToken();
        }

        return true;
}

function UserLogoutPunBB(&$user) {
        global $pun_user;

        redirect('/forums/login.php?action=out&id='.$pun_user['id'], 'Logging out. Redirecting &hellip;');
}

function UserLoginFormPunBB(&$template) {
        $referer = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : 'index.php';
        header('Location: http://hostname/login/?redirect_url='.$referer);
}

?>

Last edited by bradleyb (2006-12-13 22:32:09)

Offline

 

#23 2007-03-16 20:43:39

Noopectro
New member
Registered: 2007-03-16
Posts: 1

Re: Thoughts regarding the wiki

Just a quck note.. I got around the caching problem by adding this line

Code:

$wgCacheEpoch = date("YmdHis");

To the bottom of PunBBAuth.php (After the last piece of code but before the ?>).

It's just a quick fix, all it does is clear the cache just after logging in and just after logging out.

Last edited by Noopectro (2007-03-16 20:44:41)

Offline

 

#24 2007-07-21 12:57:56

adioe3
New member
Registered: 2007-07-21
Posts: 1

Re: Thoughts regarding the wiki

I've tried using bradleyb's script with MediaWiki 1.10.1 and th login/logout works but registering a new user doesn't ...
The error I get is:

Code:

Database error
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: (SQL query hidden)

from within function "User::addToDatabase". MySQL returned error "1062: Duplicate entry '' for key 2 (localhost)".

Last edited by adioe3 (2007-07-21 13:41:06)

Offline

 

#25 2007-10-16 17:10:02

unicum
Member
Registered: 2007-10-16
Posts: 10

Re: Thoughts regarding the wiki

adioe3 wrote:

I've tried using bradleyb's script with MediaWiki 1.10.1 and th login/logout works but registering a new user doesn't ...
The error I get is:

Code:

Database error
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: (SQL query hidden)

from within function "User::addToDatabase". MySQL returned error "1062: Duplicate entry '' for key 2 (localhost)".

Have you solved it yet?

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.