-
Notifications
You must be signed in to change notification settings - Fork 33
/
bbpress.php
119 lines (104 loc) · 2.83 KB
/
bbpress.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* MyBB 1.8 Merge System
* Copyright 2014 MyBB Group, All Rights Reserved
*
* Website: http://www.mybb.com
* License: http://www.mybb.com/download/merge-system/license/
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
class BBPRESS_Converter extends Converter
{
/**
* String of the bulletin board name
*
* @var string
*/
var $bbname = "BBPress 2.5";
/**
* String of the plain bulletin board name
*
* @var string
*/
var $plain_bbname = "BBPress 2.5";
/**
* Whether or not this module requires the loginconvert.php plugin
*
* @var boolean
*/
var $requires_loginconvert = true;
/**
* Array of all of the modules
*
* @var array
*/
var $modules = array("db_configuration" => array("name" => "Database Configuration", "dependencies" => ""),
"import_users" => array("name" => "Users", "dependencies" => "db_configuration"),
"import_forums" => array("name" => "Forums", "dependencies" => "db_configuration,import_users"),
"import_threads" => array("name" => "Threads", "dependencies" => "db_configuration,import_forums"),
"import_posts" => array("name" => "Posts", "dependencies" => "db_configuration,import_threads"),
"import_avatars" => array("name" => "Avatars", "dependencies" => "db_configuration,import_users"),
);
/**
* The table we check to verify it's "our" database
*
* @var String
*/
var $check_table = "usermeta";
/**
* The table prefix we suggest to use
*
* @var String
*/
var $prefix_suggestion = "wp_";
/**
* An array of bbpress -> mybb groups
* bbpress doesn't use id's but names
*
* @var array
*/
var $groups = array(
"bbp_blocked" => MYBB_BANNED, // Banned
"bbp_spectator" => MYBB_REGISTERED, // Registered
"bbp_participant" => MYBB_REGISTERED, // Registered
"bbp_moderator" => MYBB_SMODS, // Super Moderators
"bbp_keymaster" => MYBB_ADMINS, // Administrators
);
/**
* What BBCode Parser we're using
*
* @var String
*/
var $parser_class = "html";
/**
* An array of supported databases
* WordPress (and therefor bbPress) only support MySQL
*/
var $supported_databases = array("mysql");
/**
* Convert a serialized list of original roes in one of mybb
*
* @param string $gids A serialized list of original roles
* @return string group id(s)
*/
function get_group_id($gids)
{
// bbPress saves roles as ["name" => true]
$roles = array_keys(unserialize($gids));
// A user can have multiple roles but only one for bbPress
foreach($roles as $role)
{
// We found our role so return it
if(isset($this->groups[$role]))
{
return $this->groups[$role];
}
}
// The user hadn't a role but he was registered
return MYBB_REGISTERED;
}
}