This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php declare(strict_types=1); |
||||||
2 | // Author: SMD & Trabis |
||||||
3 | // URL: https://www.xoopsmalaysia.org & https://www.xoops.org |
||||||
4 | // E-Mail: [email protected] & [email protected] |
||||||
5 | |||||||
6 | if (!defined('XOOPS_ROOT_PATH')) { |
||||||
7 | exit; |
||||||
8 | } |
||||||
9 | |||||||
10 | function show_membersonline_block($options) |
||||||
11 | { |
||||||
12 | global $xoopsConfig, $xoopsUser, $xoopsModule, $xoopsDB, $_SERVER; |
||||||
13 | |||||||
14 | /** @var XoopsOnlineHandler $onlineHandler */ |
||||||
15 | $onlineHandler = xoops_getHandler('online'); |
||||||
16 | // set gc probabillity to 10% for now.. |
||||||
17 | if (mt_rand(1, 100) < 11) { |
||||||
18 | $onlineHandler->gc(300); |
||||||
19 | } |
||||||
20 | if (is_object($xoopsUser)) { |
||||||
21 | $uid = $xoopsUser->getVar('uid'); |
||||||
22 | $name = $xoopsUser->getVar('name'); |
||||||
23 | if ($options[4] == '1' && $name != '') { |
||||||
24 | $uname = $xoopsUser->getVar('name'); |
||||||
25 | } else { |
||||||
26 | $uname = $xoopsUser->getVar('uname'); |
||||||
27 | } |
||||||
28 | } else { |
||||||
29 | $uid = 0; |
||||||
30 | $uname = ''; |
||||||
31 | $name = ''; |
||||||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||||||
32 | } |
||||||
33 | $requestIp = \Xmf\IPAddress::fromRequest()->asReadable(); |
||||||
34 | $requestIp = (false === $requestIp) ? '0.0.0.0' : $requestIp; |
||||||
0 ignored issues
–
show
|
|||||||
35 | if (is_object($xoopsModule)) { |
||||||
36 | $onlineHandler->write($uid, $uname, time(), $xoopsModule->getVar('mid'), $requestIp); |
||||||
37 | } else { |
||||||
38 | $onlineHandler->write($uid, $uname, time(), 0, $requestIp); |
||||||
39 | } |
||||||
40 | $onlines = $onlineHandler->getAll(); |
||||||
41 | if (!empty($onlines)) { |
||||||
42 | $total = count($onlines); |
||||||
43 | $block = []; |
||||||
44 | $guests = 0; |
||||||
45 | $membersname = ''; |
||||||
46 | $membersavatar = ''; |
||||||
0 ignored issues
–
show
|
|||||||
47 | $avatar = ''; |
||||||
0 ignored issues
–
show
|
|||||||
48 | $uid = ''; |
||||||
0 ignored issues
–
show
|
|||||||
49 | $name = ''; |
||||||
50 | $onlineUsers = []; |
||||||
51 | for ($i = 0; $i < $total; ++$i) { |
||||||
52 | if ($onlines[$i]['online_uid'] == 0) { |
||||||
53 | $onlineUsers[$i]['user'] = ''; |
||||||
54 | } else { |
||||||
55 | $onlineUsers[$i]['user'] = new XoopsUser($onlines[$i]['online_uid']); |
||||||
56 | } |
||||||
57 | if (is_object($onlineUsers[$i]['user'])) { |
||||||
58 | $block['avatar'] = $onlineUsers[$i]['user']->getVar('user_avatar'); |
||||||
59 | $block['uid'] = $onlineUsers[$i]['user']->getVar('uid'); |
||||||
60 | |||||||
61 | $realname = $onlineUsers[$i]['user']->getVar('name'); |
||||||
62 | if ('1' == $options[5] && '' != $realname) { |
||||||
63 | $block['name'] = $onlineUsers[$i]['user']->getVar('name'); |
||||||
64 | } else { |
||||||
65 | $block['name'] = $onlineUsers[$i]['user']->getVar('uname'); |
||||||
66 | } |
||||||
67 | } |
||||||
68 | |||||||
69 | if ($onlines[$i]['online_uid'] > 0) { |
||||||
70 | $membersname .= '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $onlines[$i]['online_uid'] . '" title="' . $onlines[$i]['online_uname'] . '">' . $onlines[$i]['online_uname'] . '</a>, '; |
||||||
71 | } else { |
||||||
72 | ++$guests; |
||||||
73 | } |
||||||
74 | } |
||||||
75 | $block['online_total'] = sprintf(_ONLINEPHRASE, $total); |
||||||
76 | if (is_object($xoopsModule)) { |
||||||
77 | $mytotal = $onlineHandler->getCount(new Criteria('online_module', $xoopsModule->getVar('mid'))); |
||||||
78 | $block['online_total'] .= ' (' . sprintf(_ONLINEPHRASEX, $mytotal, $xoopsModule->getVar('name')) . ')'; |
||||||
79 | } |
||||||
80 | // Membership Statistic |
||||||
81 | /** @var \XoopsMemberHandler $memberHandler */ |
||||||
82 | $memberHandler = xoops_getHandler('member'); |
||||||
83 | $today = formatTimestamp(time()); |
||||||
0 ignored issues
–
show
|
|||||||
84 | $level_criteria = new Criteria('level', 0, '>'); |
||||||
85 | $criteria = new CriteriaCompo($level_criteria); |
||||||
86 | $criteria24 = new CriteriaCompo($level_criteria); |
||||||
87 | $criteria48 = new CriteriaCompo($level_criteria); |
||||||
88 | $total_active_users = $memberHandler->getUserCount($level_criteria); |
||||||
89 | //Fixing stats for last 24 and 48 hours |
||||||
90 | $users_reg_24 = $memberHandler->getUserCount($criteria24->add(new Criteria('user_regdate', (mktime(0, 0, 0) - (24 * 3600)), '>=')), 'AND'); |
||||||
0 ignored issues
–
show
The call to
XoopsMemberHandler::getUserCount() has too many arguments starting with 'AND' .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
91 | $users_reg_48 = $memberHandler->getUserCount($criteria48->add(new Criteria('user_regdate', (mktime(0, 0, 0) - (48 * 3600)), '>=')), 'AND'); |
||||||
92 | $limit = 1; |
||||||
93 | $criteria->setOrder('DESC'); |
||||||
94 | $criteria->setSort('user_regdate'); |
||||||
95 | $criteria->setLimit($limit); |
||||||
96 | |||||||
97 | // data |
||||||
98 | $block['activeusers'] = $total_active_users; |
||||||
99 | $block['todayreg'] = $users_reg_24; |
||||||
100 | $block['yesterdayreg'] = $users_reg_48 - $users_reg_24; |
||||||
101 | $block['total_online'] = sprintf(_MB_XOOPSMEMBERS_TOTALONLINE, $total); |
||||||
102 | $block['online_members'] = $total - $guests . ' ' . _MB_XOOPSMEMBERS_MEMBERS . ' ' . _MB_XOOPSMEMBERS_CURRENTONLINE; |
||||||
103 | $block['online_guests'] = $guests . ' ' . _MB_XOOPSMEMBERS_GUESTS . ' ' . _MB_XOOPSMEMBERS_AND; |
||||||
104 | |||||||
105 | $block['showonlinemember'] = $options[0]; |
||||||
106 | $block['showonlinename'] = $options[1]; |
||||||
107 | $block['showonlineavatar'] = $options[2]; |
||||||
108 | $block['showonlinepopup'] = $options[3]; |
||||||
109 | $block['showtotalonline'] = $options[4]; |
||||||
110 | $block['userealname'] = $options[5]; |
||||||
111 | $block['memberdisplay'] = $options[6]; |
||||||
112 | |||||||
113 | return $block; |
||||||
114 | } |
||||||
115 | |||||||
116 | return false; |
||||||
117 | } |
||||||
118 | |||||||
119 | function membersonline_edit($options) |
||||||
120 | { |
||||||
121 | $chk = ''; |
||||||
122 | $form = _MB_XOOPSMEMBERS_SHOWONLINEMEMBER . ' '; |
||||||
123 | if ($options[0] == 1) { |
||||||
124 | $chk = ' checked'; |
||||||
125 | } |
||||||
126 | $form .= "<input type='radio' name='options[0]' value='1'" . $chk . '> ' . _YES . ''; |
||||||
127 | if ($options[0] == 0) { |
||||||
128 | $chk = ' checked'; |
||||||
129 | } |
||||||
130 | $form .= " <input type='radio' name='options[0]' value='0'" . $chk . '>' . _NO . '<br>'; |
||||||
131 | |||||||
132 | $form .= _MB_XOOPSMEMBERS_SHOWONLINENAME . ' '; |
||||||
133 | if ($options[1] == 1) { |
||||||
134 | $chk = ' checked'; |
||||||
135 | } |
||||||
136 | $form .= "<input type='radio' name='options[1]' value='1'" . $chk . '> ' . _YES . ''; |
||||||
137 | $chk = ''; |
||||||
138 | if ($options[1] == 0) { |
||||||
139 | $chk = ' checked'; |
||||||
140 | } |
||||||
141 | $form .= " <input type='radio' name='options[1]' value='0'" . $chk . '>' . _NO . '<br>'; |
||||||
142 | |||||||
143 | $form .= _MB_XOOPSMEMBERS_SHOWONLINEAVATAR . ' '; |
||||||
144 | if ($options[2] == 1) { |
||||||
145 | $chk = ' checked'; |
||||||
146 | } |
||||||
147 | $form .= "<input type='radio' name='options[2]' value='1'" . $chk . '> ' . _YES . ''; |
||||||
148 | $chk = ''; |
||||||
149 | if ($options[2] == 0) { |
||||||
150 | $chk = ' checked'; |
||||||
151 | } |
||||||
152 | $form .= " <input type='radio' name='options[2]' value='0'" . $chk . '>' . _NO . '<br>'; |
||||||
153 | |||||||
154 | $form .= _MB_XOOPSMEMBERS_SHOWONLINEPOPUP . ' '; |
||||||
155 | if ($options[3] == 1) { |
||||||
156 | $chk = ' checked'; |
||||||
157 | } |
||||||
158 | $form .= "<input type='radio' name='options[3]' value='1'" . $chk . '> ' . _YES . ''; |
||||||
159 | $chk = ''; |
||||||
160 | if ($options[3] == 0) { |
||||||
161 | $chk = ' checked'; |
||||||
162 | } |
||||||
163 | $form .= " <input type='radio' name='options[3]' value='0'" . $chk . '>' . _NO . '<br>'; |
||||||
164 | |||||||
165 | $form .= _MB_XOOPSMEMBERS_SHOWTOTALONLINE . ' '; |
||||||
166 | if ($options[4] == 1) { |
||||||
167 | $chk = ' checked'; |
||||||
168 | } |
||||||
169 | $form .= "<input type='radio' name='options[4]' value='1'" . $chk . '> ' . _YES . ''; |
||||||
170 | $chk = ''; |
||||||
171 | if ($options[4] == 0) { |
||||||
172 | $chk = ' checked'; |
||||||
173 | } |
||||||
174 | $form .= " <input type='radio' name='options[4]' value='0'" . $chk . '>' . _NO . '<br>'; |
||||||
175 | |||||||
176 | $form .= _MB_XOOPSMEMBERS_USEREALNAME . ' '; |
||||||
177 | if ($options[5] == 1) { |
||||||
178 | $chk = ' checked'; |
||||||
179 | } |
||||||
180 | $form .= "<input type='radio' name='options[5]' value='1'" . $chk . '> ' . _YES . ''; |
||||||
181 | $chk = ''; |
||||||
182 | if ($options[5] == 0) { |
||||||
183 | $chk = ' checked'; |
||||||
184 | } |
||||||
185 | $form .= " <input type='radio' name='options[5]' value='0'" . $chk . '>' . _NO . '<br>'; |
||||||
186 | |||||||
187 | $form .= _MB_XOOPSMEMBERS_MEMBERDISPLAY . ' '; |
||||||
188 | $form .= "<input type='text' name='options[6]' value='" . $options[6] . "'>"; |
||||||
189 | |||||||
190 | return $form; |
||||||
191 | } |
||||||
192 |