forked from multidimension-al/phpbbauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PhpbbAuth.php
71 lines (62 loc) · 2.43 KB
/
PhpbbAuth.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
60
61
62
63
64
65
66
67
68
69
70
71
<?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-2019 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
*/
if ( !isset( $wgPhpbbAuthForumDirectory ) ) {
$wgPhpbbAuthForumDirectory = './../phpBB3/';
}
define( 'PHPBB_ROOT_PATH', $wgPhpbbAuthForumDirectory );
define( 'IN_PHPBB', true );
$phpbb_root_path = PHPBB_ROOT_PATH;
$phpEx = substr( strrchr( __FILE__, '.' ), 1 );
require $phpbb_root_path . 'common.' . $phpEx;
// Start session management
$user->session_begin();
$auth->acl( $user->data );
$user->setup();
if($config['version'] >= 3.1){
$request->enable_super_globals();
}
if ( !isset($wgPhpbbAuthAbsolutePath) ) {
if($config['force_server_vars']){
$wgPhpbbAuthAbsolutePath = ($config['server_protocol'] ? $config['server_protocol'] : '//') . $config['server_name'] . $config['script_path'] . '/';
} else {
$wgPhpbbAuthAbsolutePath = $wgPhpbbAuthForumDirectory;
}
}
if ( $user->data['user_id'] != ANONYMOUS && !$user->data['is_bot'] ) {
if($wgPhpbbAuthNameFormat == 'phpbb'){
$wgAuthRemoteuserUserName = $user->data['username'];
} else {
$wgAuthRemoteuserUserName = ucfirst( strtolower( $user->data['username'] ) );
}
$wgAuthRemoteuserUserPrefs = [
'realname' => $user->data['username'],
'language' => 'en',
'disablemail' => 0
];
$wgAuthRemoteuserUserPrefsForced = [
'email' => $user->data['user_email']
];
$wgDefaultUserOptions['disablemail'] = 0;
$wgHiddenPrefs[] = 'disablemail';
$wgAuthRemoteuserUserUrls = [
'logout' => $wgPhpbbAuthAbsolutePath . 'ucp.php?mode=logout&sid=' . $user->session_id
];
}