It's not really a mod... it's more like a new version
AuthPlugin_vbMediaWiki.php
PHP Code:
<?php
/**
*/
# Copyright (C) 2004 Brion Vibber <brion@pobox.com>
# http://www.mediawiki.org/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# http://www.gnu.org/copyleft/gpl.html
/**
* Authentication plugin interface. Instantiate a subclass of AuthPlugin
* and set $wgAuth to it to authenticate against some external tool.
*
* The default behavior is not to do anything, and use the local user
* database for all authentication. A subclass can require that all
* accounts authenticate externally, or use it only as a fallback; also
* you can transparently create internal wiki accounts the first time
* someone logs in who can be authenticated externally.
*/
$current_dir = getcwd();
chdir( '../forum' );
require_once( "global.php" );
require_once( "includes/functions.php" );
chdir( $current_dir );
require_once( "$IP/includes/AuthPlugin.php" );
/**
* Users can't change their passwords here
*/
class AuthPlugin_vbMediaWiki extends AuthPlugin {
public function allowPasswordChange() {
return false;
}
}
$wgAuth = new AuthPlugin_vbMediaWiki();
/**
* Set the 'vbmediawikiskin' skin as default and prevent users from changing it
* - we have only one integrated skin right now
*/
$wgDefaultSkin = 'vbwikiskin';
$wgAllowUserSkin = false;
/**
* Disable email and real name
* - Not sure yet how to solve conflicts between vBulletin and MediWiki user data changes
*/
$wgEnableEmail = false;
$wgAllowRealName = false;
/**
* Disable 'pretty' URLs, e.g. index.php/Page_title
* - We need to disable it or rewrite code for vBulletin's "Who's Online"
*/
$wgUsePathInfo = false;
/**
* Set this to false to avoid forcing the first letter of links to capitals.
* - vBulletin user names can be lower case, so we need that
*/
$wgCapitalLinks = false;
/**
* Disabling new user registrations and anonymous edits
* - vBulletin user names can be lower case, so we need that
*/
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;
/**
* Disable manual login and logout functions for all users and remove the ChangePassword page
* - vBulletin will do the login/logout stuff and also the Password should be changes there
*/
function SpecialPage_initListHook( &$aSpecialPages )
{
unset( $aSpecialPages['Userlogout'] );
unset( $aSpecialPages['Userlogin'] );
unset( $aSpecialPages['Resetpass'] );
return true;
}
$wgHooks['SpecialPage_initList'][] = 'SpecialPage_initListHook';
/**
* Remove login and logout buttons for all users
* - vBulletin shows them in the navbar anyway
*/
function PersonalUrlsHook( &$personal_urls, &$title )
{
unset( $personal_urls["login"] );
unset( $personal_urls["logout"] );
unset( $personal_urls['anonlogin'] );
return true;
}
$wgHooks['PersonalUrls'][] = 'PersonalUrlsHook';
/**
* User Group Translation
* - NoLogin: Can't login to wiki... only to vBulletin
* - Sysop: Wiki Administrators
* - Bureaucrat: Could edit user rights... but they will be reseted anyway
* It's more clear if we only allow a group like moderators to Administrate the Wiki
*/
$vwNoLoginGroups = array();
$vwSysopGroups = array(6,7);
$vwBureaucratGroups = array(6);
/**
* Minimum number of posts a user need in to login to the Wiki
* - This is a community portal... only real members of the community should edit the Wiki
*/
$vwMinReputationPosts = 5;
$vwMinReputationPostsNotice = 'wiki_posts';
/**
* Sync user to vBulletin
* - Same user for the Wiki as in vBulletin
*/
function UserLoadFromSessionHook( $user, &$result ) {
global $vbulletin;
global $vwNoLoginGroups, $vwSysopGroups, $vwBureaucratGroups;
global $vwMinReputationPosts, $vwMinReputationPostsNotice;
// check if user is authenticated (by another hook)
if ( $user != null ) {
if ( !$user->isAnon() ) {
// User is not anonymous.
// Check for the existence of a valid vB userid. If we don't have one, log the old user out.
if ( $vbulletin->userinfo['userid'] == 0 ) {
$user->logout();
}
// Check vwNoLoginGroups
// If they're logged in and shouldn't be, log them out!
if ( is_member_of( $vbulletin->userinfo, $vwNoLoginGroups ) ) {
$user->logout();
break;
}
if( $vbulletin->userinfo['posts'] < $vwMinReputationPosts ) {
if( $vwMinReputationPostsNotice != null ) {
$vbulletin->noticecache = array(
$vwMinReputationPostsNotice => array(
'has_x_postcount' => array(0,$vwMinReputationPosts + 1)
)
);
}
$user->logout();
break;
}
return true;
}
$user->logout();
}
if ( $vbulletin->userinfo['userid'] )
{
// Check vwNoLoginGroups
if ( is_member_of( $vbulletin->userinfo, $vwNoLoginGroups ) ) {
return true;
}
if( $vbulletin->userinfo['posts'] < $vwMinReputationPosts ) {
if( $vwMinReputationPostsNotice != null ) {
$vbulletin->noticecache = array(
$vwMinReputationPostsNotice => array(
'has_x_postcount' => array(0,$vwMinReputationPosts + 1)
)
);
}
return true;
}
$username = $vbulletin->userinfo['username'];
if ( $username ) {
$u = User::newFromName( $username );
if (is_null($u)) {
// Invalid username or some other error...
return;
}
if ( $u->getID() == 0 ) {
$u->addToDatabase();
$u->setToken();
}
else $u->loadFromDatabase();
$user = $u;
$user->setOption( 'rememberpassword', 1 );
$user->saveSettings();
$user->setCookies();
// Check vwSysopGroups.
$user->removeGroup( 'sysop' );
if ( is_member_of( $vbulletin->userinfo, $vwSysopGroups ) ) {
$user->addGroup( 'sysop' );
}
// Check vwBureaucratGroups.
$user->removeGroup( 'bureaucrat' );
if ( is_member_of( $vbulletin->userinfo, $vwBureaucratGroups ) ) {
$user->addGroup( 'bureaucrat' );
}
}
}
else $user->logout();
return true;
}
$wgHooks['UserLoadFromSession'][] = 'UserLoadFromSessionHook';
and there are much more changes, like a new wiki skin and other changes for getting the vB WOL working right