-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWebPlatformAuth.php
59 lines (48 loc) · 2.31 KB
/
WebPlatformAuth.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* MediaWiki SSO using Firefox Accounts
*
* Project details are available on the WebPlatform wiki
* https://docs.webplatform.org/wiki/WPD:Projects/SSO/MediaWikiExtension
*
* @ingroup Extensions
*
* @version 2.0-dev
*/
if ( !defined( 'MEDIAWIKI' ) ) {
echo( "Not an entry point." );
die( -1 );
}
//if ( version_compare( $GLOBALS['wgVersion'], '1.22', '<' ) ) {
// die( '<b>Error:</b> This extension requires MediaWiki 1.22 or above' );
//}
$dir = dirname(__FILE__) . '/';
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
$loader = require( __DIR__ . '/vendor/autoload.php' );
$loader->add( 'Guzzle\\', $dir . '/vendor/guzzlehttp/guzzle/src/Guzzle/' );
} else {
die('You MUST install Composer dependencies');
}
$wgExtensionCredits['other'][] = array(
'name' => 'WebPlatformAuth',
'path' => __FILE__,
'version' => '2.0-dev',
'author' => array('[https://renoirboulanger.com Renoir Boulanger]'),
'url' => 'http://docs.webplatform.org/wiki/WPD:Projects/SSO/MediaWikiExtension',
'description' => 'Single Sign On MediaWiki extension',
);
$wgAutoloadClasses['WebPlatformAuthHooks'] = $dir . 'includes/WebPlatformAuthHooks.php';
$wgAutoloadClasses['AccountsHandlerSpecialPage'] = $dir . 'includes/specials/AccountsHandlerSpecialPage.php';
$wgAutoloadClasses['WebPlatformAuthLogin'] = $dir . 'includes/specials/WebPlatformAuthLogin.php';
$wgAutoloadClasses['WebPlatformAuthLogout'] = $dir . 'includes/specials/WebPlatformAuthLogout.php';
$wgAutoloadClasses['WebPlatformAuthPassword'] = $dir . 'includes/specials/WebPlatformAuthPassword.php';
$wgMessagesDirs['WebPlatformAuth'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['WebPlatformAuth'] = $dir . 'WebPlatformAuth.i18n.php';
// Change AccountsHandler for better name later #TODO
$wgSpecialPages['AccountsHandler'] = 'AccountsHandlerSpecialPage';
$wgSpecialPages['Userlogin'] = 'WebPlatformAuthLogin';
$wgSpecialPages['Userlogout'] = 'WebPlatformAuthLogout';
$wgSpecialPages['ChangePassword'] = 'WebPlatformAuthPassword';
$wgHooks['UserLoadFromSession'][] = 'WebPlatformAuthHooks::onUserLoadFromSession';
$wgHooks['GetPreferences'][] = 'WebPlatformAuthHooks::hookLimitPreferences';
$wgHooks['SpecialPage_initList'][] = 'WebPlatformAuthHooks::hookInitSpecialPages';