|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Newbb; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* NewBB 5.0x, the forum module for XOOPS project |
|
7
|
|
|
* |
|
8
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
9
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
|
10
|
|
|
* @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
|
11
|
|
|
* @since 4.00 |
|
12
|
|
|
* @package module::newbb |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
use XoopsModules\Newbb; |
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
\defined('NEWBB_FUNCTIONS_INI') || require $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Class UserHandler |
|
23
|
|
|
*/ |
|
24
|
|
|
class UserHandler |
|
25
|
|
|
{ |
|
26
|
|
|
/** @var array */ |
|
27
|
|
|
public $users = []; |
|
28
|
|
|
|
|
29
|
|
|
/** @var bool */ |
|
30
|
|
|
private $enableGroup; |
|
31
|
|
|
|
|
32
|
|
|
/** @var bool */ |
|
33
|
|
|
private $enableOnline; |
|
34
|
|
|
|
|
35
|
|
|
/** @var array */ |
|
36
|
|
|
private $userlist = []; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param bool $enableGroup |
|
40
|
|
|
* @param bool $enableOnline |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct($enableGroup = true, $enableOnline = true) |
|
43
|
|
|
{ |
|
44
|
|
|
$this->enableGroup = $enableGroup; |
|
45
|
|
|
$this->enableOnline = $enableOnline; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function loadUserInfo() |
|
49
|
|
|
{ |
|
50
|
|
|
/** @var Newbb\Helper $helper */ |
|
51
|
|
|
$helper = \XoopsModules\Newbb\Helper::getInstance(); |
|
52
|
|
|
$helper->loadLanguage('user'); |
|
53
|
|
|
// @require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/user.php'); |
|
54
|
|
|
if (\class_exists('UserLanguage')) { |
|
55
|
|
|
$handler = new Newbb\UserLanguage(); |
|
|
|
|
|
|
56
|
|
|
} else { |
|
57
|
|
|
$handler = new User(); |
|
58
|
|
|
} |
|
59
|
|
|
foreach (\array_keys($this->users) as $uid) { |
|
60
|
|
|
$this->userlist[$uid] = $handler->getInfo($this->users[$uid]); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function loadUserOnline() |
|
65
|
|
|
{ |
|
66
|
|
|
if (empty($this->users) || !$this->enableOnline) { |
|
67
|
|
|
return; |
|
68
|
|
|
} |
|
69
|
|
|
require_once \dirname(__DIR__) . '/include/functions.render.php'; |
|
70
|
|
|
$image_online = \newbbDisplayImage('online', \_MD_NEWBB_ONLINE); |
|
71
|
|
|
$image_offline = \newbbDisplayImage('offline', \_MD_NEWBB_OFFLINE); |
|
72
|
|
|
|
|
73
|
|
|
/** @var Newbb\OnlineHandler $onlineHandler */ |
|
74
|
|
|
$onlineHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Online'); |
|
75
|
|
|
$onlines = $onlineHandler->checkStatus(\array_keys($this->users)); |
|
76
|
|
|
|
|
77
|
|
|
foreach (\array_keys($this->users) as $uid) { |
|
78
|
|
|
$this->userlist[$uid]['status'] = empty($onlines[$uid]) ? $image_offline : $image_online; |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
// START irmtfan remove function - no deprecated is needed because just use in this file |
|
83
|
|
|
// function loadUserGroups() |
|
84
|
|
|
// { |
|
85
|
|
|
// return true; |
|
86
|
|
|
// } |
|
87
|
|
|
// END irmtfan remove function - no deprecated is needed because just use in this file |
|
88
|
|
|
|
|
89
|
|
|
public function loadUserDigest() |
|
90
|
|
|
{ |
|
91
|
|
|
if (empty($this->users)) { |
|
92
|
|
|
return; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
$sql = 'SELECT user_digests, uid FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . ' WHERE uid IN( ' . \implode(', ', \array_keys($this->users)) . ')'; |
|
96
|
|
|
$result = $GLOBALS['xoopsDB']->query($sql); |
|
97
|
|
|
while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
98
|
|
|
$this->userlist[$myrow['uid']]['digests'] = (int)$myrow['user_digests']; |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
// START irmtfan remove function |
|
103
|
|
|
// function loadUserRank() |
|
104
|
|
|
// { |
|
105
|
|
|
// return true; |
|
106
|
|
|
// } |
|
107
|
|
|
// END irmtfan remove function |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @return array |
|
111
|
|
|
*/ |
|
112
|
|
|
public function getUsers() |
|
113
|
|
|
{ |
|
114
|
|
|
$this->loadUserInfo(); |
|
115
|
|
|
$this->loadUserOnline(); |
|
116
|
|
|
// irmtfan removed $this->loadUserGroups(); |
|
117
|
|
|
// irmtfan removed $this->loadUserRank(); |
|
118
|
|
|
$this->loadUserDigest(); |
|
119
|
|
|
|
|
120
|
|
|
return $this->userlist; |
|
121
|
|
|
} |
|
122
|
|
|
} |
|
123
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths