-
Notifications
You must be signed in to change notification settings - Fork 5
/
PhpbbAuthHooks.php
55 lines (43 loc) · 2.25 KB
/
PhpbbAuthHooks.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
<?php
/**
* __ ___ ____ _ ___ _ __
* / |/ /_ __/ / /_(_)___/ (_)___ ___ ___ ____ _____(_)___ ____ ____ _/ /
* / /|_/ / / / / / __/ / __ / / __ `__ \/ _ \/ __ \/ ___/ / __ \/ __ \ / __ `/ /
* / / / / /_/ / / /_/ / /_/ / / / / / / / __/ / / (__ ) / /_/ / / / // /_/ / /
* /_/ /_/\__,_/_/\__/_/\__,_/_/_/ /_/ /_/\___/_/ /_/____/_/\____/_/ /_(_)__,_/_/
*
* phpBB Auth: MediaWiki Authentication Extension
* Copyright (c) Multidimension.al (http://multidimension.al)
* Github : https://github.com/multidimension-al/phpbbauth
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE file
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright © 2018 Multidimension.al (http://multidimension.al)
* @link https://github.com/multidimension-al/phpbbauth phpBB Auth Github
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
class PhpbbAuthHooks {
public static function onSkinTemplateNavigationUniversal($skinTemplate, &$links){
global $wgPhpbbAuthAbsolutePath, $wgServer;
if( array_key_exists( 'user-menu', $links ) ){
if ( array_key_exists( 'login', $links['user-menu'] ) ) {
$links['user-menu']['login']['href'] = $wgPhpbbAuthAbsolutePath . 'ucp.php?mode=login&redirect=' . urlencode( $wgServer . $_SERVER[ 'REQUEST_URI' ] );
}
if ( array_key_exists( 'anonlogin', $links['user-menu'] ) ) {
$links['user-menu']['anonlogin']['href'] = $wgPhpbbAuthAbsolutePath . 'ucp.php?mode=login&redirect=' . urlencode( $wgServer . $_SERVER[ 'REQUEST_URI' ] );
}
}
}
public static function onPersonalUrls( array &$personal_urls, Title $title, SkinTemplate $skin ) {
global $wgPhpbbAuthAbsolutePath, $wgServer;
if ( array_key_exists( 'login', $personal_urls ) ) {
$personal_urls['login']['href'] = $wgPhpbbAuthAbsolutePath . 'ucp.php?mode=login&redirect=' . urlencode( $wgServer . $_SERVER[ 'REQUEST_URI' ] );
}
if ( array_key_exists( 'anonlogin', $personal_urls ) ) {
$personal_urls['anonlogin']['href'] = $wgPhpbbAuthAbsolutePath . 'ucp.php?mode=login&redirect=' . urlencode( $wgServer . $_SERVER[ 'REQUEST_URI' ] );
}
return true;
}
}