1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* @package Board3 Portal v2.1 |
5
|
|
|
* @copyright (c) 2013 Board3 Group ( www.board3.de ) |
6
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
7
|
|
|
* |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace board3\portal\modules; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @package Who is online |
14
|
|
|
*/ |
15
|
|
|
class whois_online extends module_base |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* Allowed columns: Just sum up your options (Exp: left + right = 10) |
19
|
|
|
* top 1 |
20
|
|
|
* left 2 |
21
|
|
|
* center 4 |
22
|
|
|
* right 8 |
23
|
|
|
* bottom 16 |
24
|
|
|
*/ |
25
|
|
|
public $columns = 31; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Default modulename |
29
|
|
|
*/ |
30
|
|
|
public $name = 'PORTAL_WHOIS_ONLINE'; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Default module-image: |
34
|
|
|
* file must be in "{T_THEME_PATH}/images/portal/" |
35
|
|
|
*/ |
36
|
|
|
public $image_src = 'portal_friends.png'; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* module-language file |
40
|
|
|
* file must be in "language/{$user->lang}/mods/portal/" |
41
|
|
|
*/ |
42
|
|
|
public $language = 'portal_whois_online_module'; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* custom acp template |
46
|
|
|
* file must be in "adm/style/portal/" |
47
|
|
|
*/ |
48
|
|
|
public $custom_acp_tpl = ''; |
49
|
|
|
|
50
|
|
|
/** @var \phpbb\auth\auth */ |
51
|
|
|
protected $auth; |
52
|
|
|
|
53
|
|
|
/** @var \phpbb\config\config */ |
54
|
|
|
protected $config; |
55
|
|
|
|
56
|
|
|
/** @var \phpbb\db\driver\driver_interface */ |
57
|
|
|
protected $db; |
58
|
|
|
|
59
|
|
|
/** @var \phpbb\template\template */ |
60
|
|
|
protected $template; |
61
|
|
|
|
62
|
|
|
/** @var \phpbb\user */ |
63
|
|
|
protected $user; |
64
|
|
|
|
65
|
|
|
/** @var string phpBB root path */ |
66
|
|
|
protected $phpbb_root_path; |
67
|
|
|
|
68
|
|
|
/** @var string PHP file extension */ |
69
|
|
|
protected $php_ext; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Construct a user menu object |
73
|
|
|
* |
74
|
|
|
* @param \phpbb\auth\auth $auth phpBB auth |
75
|
|
|
* @param \phpbb\config\config $config phpBB config |
76
|
|
|
* @param \phpbb\db\driver\driver_interface $db phpBB db driver |
77
|
|
|
* @param \phpbb\template\template $template phpBB template |
78
|
|
|
* @param \phpbb\user $user phpBB user |
79
|
|
|
* @param string $phpbb_root_path phpBB root path |
80
|
|
|
* @param string $phpEx php file extension |
81
|
|
|
*/ |
82
|
|
View Code Duplication |
public function __construct($auth, $config, $db, $template, $user, $phpbb_root_path, $phpEx) |
83
|
|
|
{ |
84
|
|
|
$this->auth = $auth; |
85
|
|
|
$this->config = $config; |
86
|
|
|
$this->db = $db; |
87
|
|
|
$this->template = $template; |
88
|
|
|
$this->user = $user; |
89
|
|
|
$this->phpbb_root_path = $phpbb_root_path; |
90
|
|
|
$this->php_ext = $phpEx; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* {@inheritdoc} |
95
|
|
|
*/ |
96
|
|
|
public function get_template_center($module_id) |
97
|
|
|
{ |
98
|
|
|
$order_legend = ($this->config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; |
99
|
|
|
|
100
|
|
|
// Grab group details for legend display |
101
|
|
View Code Duplication |
if ($this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) |
102
|
|
|
{ |
103
|
|
|
$sql = 'SELECT group_id, group_name, group_colour, group_type |
104
|
|
|
FROM ' . GROUPS_TABLE . ' |
105
|
|
|
WHERE group_legend > 0 |
106
|
|
|
ORDER BY ' . $order_legend . ' ASC'; |
107
|
|
|
} |
108
|
|
|
else |
109
|
|
|
{ |
110
|
|
|
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type |
111
|
|
|
FROM ' . GROUPS_TABLE . ' g |
112
|
|
|
LEFT JOIN ' . USER_GROUP_TABLE . ' ug |
113
|
|
|
ON ( |
114
|
|
|
g.group_id = ug.group_id |
115
|
|
|
AND ug.user_id = ' . (int) $this->user->data['user_id'] . ' |
116
|
|
|
AND ug.user_pending = 0 |
117
|
|
|
) |
118
|
|
|
WHERE g.group_legend > 0 |
119
|
|
|
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . (int) $this->user->data['user_id'] . ') |
120
|
|
|
ORDER BY g.' . $order_legend . ' ASC'; |
121
|
|
|
} |
122
|
|
|
$result = $this->db->sql_query($sql); |
123
|
|
|
|
124
|
|
|
$legend = array(); |
125
|
|
|
while ($row = $this->db->sql_fetchrow($result)) |
126
|
|
|
{ |
127
|
|
|
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : ''; |
128
|
|
|
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_' . $row['group_name']] : $row['group_name']; |
129
|
|
|
|
130
|
|
|
if ($row['group_name'] == 'BOTS' || ($this->user->data['user_id'] != ANONYMOUS && !$this->auth->acl_get('u_viewprofile'))) |
131
|
|
|
{ |
132
|
|
|
$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>'; |
133
|
|
|
} |
134
|
|
|
else |
135
|
|
|
{ |
136
|
|
|
$legend[] = '<a' . $colour_text . ' href="' . append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>'; |
137
|
|
|
} |
138
|
|
|
} |
139
|
|
|
$this->db->sql_freeresult($result); |
140
|
|
|
|
141
|
|
|
$legend = implode(', ', $legend); |
142
|
|
|
|
143
|
|
|
$this->template->assign_var('PORTAL_LEGEND', $legend); |
144
|
|
|
|
145
|
|
|
return 'whois_online_center.html'; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* {@inheritdoc} |
150
|
|
|
*/ |
151
|
|
|
public function get_template_side($module_id) |
152
|
|
|
{ |
153
|
|
|
return 'whois_online_side.html'; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* {@inheritdoc} |
158
|
|
|
*/ |
159
|
|
|
public function get_template_acp($module_id) |
160
|
|
|
{ |
161
|
|
|
return array( |
162
|
|
|
'title' => 'PORTAL_WHOIS_ONLINE', |
163
|
|
|
'vars' => array(), |
164
|
|
|
); |
165
|
|
|
} |
166
|
|
|
} |
167
|
|
|
|