Passed
Pull Request — master (#187)
by Michael
16:36
created

searchmembers.php (3 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
//  ------------------------------------------------------------------------ //
5
//                XOOPS - PHP Content Management System                      //
6
//                    Copyright (c) 2000 XOOPS.org                           //
7
//                       <https://xoops.org>                             //
8
// ------------------------------------------------------------------------- //
9
//  This program is free software; you can redistribute it and/or modify     //
10
//  it under the terms of the GNU General Public License as published by     //
11
//  the Free Software Foundation; either version 2 of the License, or        //
12
//  (at your option) any later version.                                      //
13
//                                                                           //
14
//  You may not change or alter any portion of this comment or credits       //
15
//  of supporting developers from this source code or any supporting         //
16
//  source code which is considered copyrighted (c) material of the          //
17
//  original comment or credit authors.                                      //
18
//                                                                           //
19
//  This program is distributed in the hope that it will be useful,          //
20
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
21
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
22
//  GNU General Public License for more details.                             //
23
//                                                                           //
24
//  You should have received a copy of the GNU General Public License        //
25
//  along with this program; if not, write to the Free Software              //
26
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
27
//  ------------------------------------------------------------------------ //
28
use Xmf\Request;
29
use XoopsModules\Suico\{
30
    FriendrequestHandler,
31
    IndexController
32
};
33
34
require __DIR__ . '/header.php';
35
$op = Request::getCmd('op', 'form', 'POST');
36
//require_once __DIR__ . '/class/suico_controller.php';
37
$controller = new IndexController($xoopsDB, $xoopsUser);
38
/**
39
 * Fetching numbers of groups friends videos pictures etc...
40
 */
41
$nbSections = $controller->getNumbersSections();
42
if ('form' === $op) {
43
    $GLOBALS['xoopsOption']['template_main'] = 'suico_searchform.tpl';
44
    require XOOPS_ROOT_PATH . '/header.php';
45
    /** @var \XoopsMemberHandler $memberHandler */
46
    $memberHandler = xoops_getHandler('member');
47
    $total         = $memberHandler->getUserCount(new Criteria('level', 0, '>'));
48
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
49
    $uname_text  = new \XoopsFormText('', 'user_uname', 30, 60);
50
    $uname_match = new \XoopsFormSelectMatchOption('', 'user_uname_match');
51
    $uname_tray  = new \XoopsFormElementTray(_MD_SUICO_UNAME, '&nbsp;');
52
    $uname_tray->addElement($uname_match);
53
    $uname_tray->addElement($uname_text);
54
    $name_text  = new \XoopsFormText('', 'user_name', 30, 60);
55
    $name_match = new \XoopsFormSelectMatchOption('', 'user_name_match');
56
    $name_tray  = new \XoopsFormElementTray(_MD_SUICO_REALNAME, '&nbsp;');
57
    $name_tray->addElement($name_match);
58
    $name_tray->addElement($name_text);
59
    $email_text  = new \XoopsFormText('', 'user_email', 30, 60);
60
    $email_match = new \XoopsFormSelectMatchOption('', 'user_email_match');
61
    $email_tray  = new \XoopsFormElementTray(_MD_SUICO_EMAIL, '&nbsp;');
62
    $email_tray->addElement($email_match);
63
    $email_tray->addElement($email_text);
64
    $url_text        = new \XoopsFormText(_MD_SUICO_URL_CONTAINS, 'user_url', 30, 100);
65
    $location_text   = new \XoopsFormText(_MD_SUICO_LOCATION_CONTAINS, 'user_from', 30, 100);
66
    $occupation_text = new \XoopsFormText(_MD_SUICO_OCCUPATION_CONTAINS, 'user_occ', 30, 100);
67
    $interest_text   = new \XoopsFormText(_MD_SUICO_INTEREST_CONTAINS, 'user_intrest', 30, 100);
68
    $extrainfo_text  = new \XoopsFormText(_MD_SUICO_EXTRAINFO_CONTAINS, 'bio', 30, 100);
69
    $signature_text  = new \XoopsFormText(_MD_SUICO_SIGNATURE_CONTAINS, 'user_sig', 30, 100);
70
    $lastlog_more    = new \XoopsFormText(
71
        _MD_SUICO_LASTLOGMORE, 'user_lastlog_more', 10, 5
72
    );
73
    $lastlog_less    = new \XoopsFormText(_MD_SUICO_LASTLOGLESS, 'user_lastlog_less', 10, 5);
74
    $reg_more        = new \XoopsFormText(_MD_SUICO_REGMORE, 'user_reg_more', 10, 5);
75
    $reg_less        = new \XoopsFormText(_MD_SUICO_REGLESS, 'user_reg_less', 10, 5);
76
    $posts_more      = new \XoopsFormText(_MD_SUICO_POSTSMORE, 'user_posts_more', 10, 5);
77
    $posts_less      = new \XoopsFormText(_MD_SUICO_POSTSLESS, 'user_posts_less', 10, 5);
78
    $sort_select     = new \XoopsFormSelect(_MD_SUICO_SORT, 'user_sort');
79
    $sort_select->addOptionArray(
80
        [
81
            'uname'        => _MD_SUICO_UNAME,
82
            'email'        => _MD_SUICO_EMAIL,
83
            'last_login'   => _MD_SUICO_LASTLOGIN,
84
            'user_regdate' => _MD_SUICO_REGDATE,
85
            'posts'        => _MD_SUICO_POSTS,
86
        ]
87
    );
88
    $order_select = new \XoopsFormSelect(_MD_SUICO_ORDER, 'user_order');
89
    $order_select->addOptionArray(
90
        [
91
            'ASC'  => _MD_SUICO_ASC,
92
            'DESC' => _MD_SUICO_DESC,
93
        ]
94
    );
95
    $limit_text    = new \XoopsFormText(_MD_SUICO_LIMIT, 'limit', 6, 2);
96
    $op_hidden     = new \XoopsFormHidden('op', 'submit');
97
    $submit_button = new \XoopsFormButton('', 'user_submit', _SUBMIT, 'submit');
98
    $form          = new \XoopsThemeForm('', 'searchform', 'searchmembers.php');
99
    $form->addElement($uname_tray);
100
    $form->addElement($name_tray);
101
    $form->addElement($email_tray);
102
    if (1 == $xoopsModuleConfig['displayurl']) {
103
        $form->addElement($url_text);
104
    }
105
    if (1 == $xoopsModuleConfig['displayfrom']) {
106
        $form->addElement($location_text);
107
    }
108
    if (1 == $xoopsModuleConfig['displayoccupation']) {
109
        $form->addElement($occupation_text);
110
    }
111
    if (1 == $xoopsModuleConfig['displayinterest']) {
112
        $form->addElement($interest_text);
113
    }
114
    if (1 == $xoopsModuleConfig['displayextrainfo']) {
115
        $form->addElement($extrainfo_text);
116
    }
117
    if (1 == $xoopsModuleConfig['displaysignature']) {
118
        $form->addElement($signature_text);
119
    }
120
    if (1 == $xoopsModuleConfig['displaylastlogin']) {
121
        $form->addElement($lastlog_more);
122
        $form->addElement($lastlog_less);
123
    }
124
    if (1 == $xoopsModuleConfig['displayregdate']) {
125
        $form->addElement($reg_more);
126
        $form->addElement($reg_less);
127
    }
128
    if (1 == $xoopsModuleConfig['displayposts']) {
129
        $form->addElement($posts_more);
130
        $form->addElement($posts_less);
131
    }
132
    $form->addElement($sort_select);
133
    $form->addElement($order_select);
134
    $form->addElement($limit_text);
135
    $form->addElement($op_hidden);
136
    $form->addElement($submit_button);
137
    $form->assign($xoopsTpl);
138
    $xoopsTpl->assign('lang_search', _MD_SUICO_SEARCH);
139
    $xoopsTpl->assign(
140
        'lang_totalusers',
141
        sprintf(_MD_SUICO_TOTALUSERS, '<span style="color:#ff0000;">' . $total . '</span>')
142
    );
143
    $xoopsTpl->assign('totalmember', $total);
144
}
145
if ('submit' === $op) {
146
    $GLOBALS['xoopsOption']['template_main'] = 'suico_searchresults.tpl';
147
    require XOOPS_ROOT_PATH . '/header.php';
148
    $iamadmin = $xoopsUserIsAdmin;
149
    $myts     = \MyTextSanitizer::getInstance();
150
    $criteria = new CriteriaCompo();
151
    if (!empty($_POST['user_uname'])) {
152
        $match = !empty($_POST['user_uname_match']) ? Request::getInt('user_uname_match', 0, 'POST') : XOOPS_MATCH_START;
153
        switch ($match) {
154
            case XOOPS_MATCH_START:
155
                $criteria->add(new Criteria('uname', Request::getString('user_uname', '', 'POST') . '%', 'LIKE'));
156
                break;
157
            case XOOPS_MATCH_END:
158
                $criteria->add(new Criteria('uname', '%' . Request::getString('user_uname', '', 'POST'), 'LIKE'));
159
                break;
160
            case XOOPS_MATCH_EQUAL:
161
                $criteria->add(new Criteria('uname', Request::getString('user_uname', '', 'POST')));
162
                break;
163
            case XOOPS_MATCH_CONTAIN:
164
                $criteria->add(
165
                    new Criteria('uname', '%' . Request::getString('user_uname', '', 'POST') . '%', 'LIKE')
166
                );
167
                break;
168
        }
169
    }
170
    if (!empty($_POST['user_name'])) {
171
        $match = !empty($_POST['user_name_match']) ? Request::getInt('user_name_match', 0, 'POST') : XOOPS_MATCH_START;
172
        switch ($match) {
173
            case XOOPS_MATCH_START:
174
                $criteria->add(new Criteria('name', Request::getString('user_uname', '', 'POST') . '%', 'LIKE'));
175
                break;
176
            case XOOPS_MATCH_END:
177
                $criteria->add(
178
                    new Criteria('name', '%' . Request::getString('user_uname', '', 'POST') . '%', 'LIKE')
179
                );
180
                break;
181
            case XOOPS_MATCH_EQUAL:
182
                $criteria->add(new Criteria('name', Request::getString('user_uname', '', 'POST')));
183
                break;
184
            case XOOPS_MATCH_CONTAIN:
185
                $criteria->add(
186
                    new Criteria('name', '%' . Request::getString('user_uname', '', 'POST') . '%', 'LIKE')
187
                );
188
                break;
189
        }
190
    }
191
    if (!empty($_POST['user_email'])) {
192
        $match = !empty($_POST['user_email_match']) ? Request::getInt('user_email_match', 0, 'POST') : XOOPS_MATCH_START;
193
        switch ($match) {
194
            case XOOPS_MATCH_START:
195
                $criteria->add(new Criteria('email', Request::getString('user_email', '', 'POST') . '%', 'LIKE'));
196
                break;
197
            case XOOPS_MATCH_END:
198
                $criteria->add(new Criteria('email', '%' . Request::getString('user_email', '', 'POST'), 'LIKE'));
199
                break;
200
            case XOOPS_MATCH_EQUAL:
201
                $criteria->add(new Criteria('email', Request::getString('user_email', '', 'POST')));
202
                break;
203
            case XOOPS_MATCH_CONTAIN:
204
                $criteria->add(
205
                    new Criteria('email', '%' . Request::getString('user_email', '', 'POST') . '%', 'LIKE')
206
                );
207
                break;
208
        }
209
        if (!$iamadmin) {
210
            $criteria->add(new Criteria('user_viewemail', 1));
211
        }
212
    }
213
    if (!empty($_POST['user_url'])) {
214
        //        $url = Request::getUrl('user_url', '', 'POST');
215
        $criteria->add(new Criteria('url', Request::getUrl('user_url', '', 'POST') . '%', 'LIKE'));
216
    }
217
    if (!empty($_POST['user_from'])) {
218
        $criteria->add(new Criteria('user_from', '%' . Request::getString('user_from', '', 'POST') . '%', 'LIKE'));
219
    }
220
    if (!empty($_POST['user_intrest'])) {
221
        $criteria->add(
222
            new Criteria('user_intrest', '%' . Request::getString('user_intrest', '', 'POST') . '%', 'LIKE')
223
        );
224
    }
225
    if (!empty($_POST['user_occ'])) {
226
        $criteria->add(new Criteria('user_occ', '%' . Request::getString('user_occ', '', 'POST') . '%', 'LIKE'));
227
    }
228
    if (!empty($_POST['bio'])) {
229
        $criteria->add(new Criteria('bio', '%' . Request::getString('bio', '', 'POST') . '%', 'LIKE'));
230
    }
231
    if (!empty($_POST['user_sig'])) {
232
        $criteria->add(new Criteria('user_sig', '%' . Request::getString('user_sig', '', 'POST') . '%', 'LIKE'));
233
    }
234
    if (!empty($_POST['user_lastlog_more']) && is_numeric($_POST['user_lastlog_more'])) {
235
        $f_user_lastlog_more = Request::getInt('user_lastlog_more', 0, 'POST');
236
        $time                = time() - (60 * 60 * 24 * $f_user_lastlog_more);
237
        if ($time > 0) {
238
            $criteria->add(new Criteria('last_login', $time, '<'));
239
        }
240
    }
241
    if (!empty($_POST['user_lastlog_less']) && is_numeric($_POST['user_lastlog_less'])) {
242
        $f_user_lastlog_less = Request::getInt('user_lastlog_less', 0, 'POST');
243
        $time                = time() - (60 * 60 * 24 * $f_user_lastlog_less);
244
        if ($time > 0) {
245
            $criteria->add(new Criteria('last_login', $time, '>'));
246
        }
247
    }
248
    if (!empty($_POST['user_reg_more']) && is_numeric($_POST['user_reg_more'])) {
249
        $f_user_reg_more = Request::getInt('user_reg_more', 0, 'POST');
250
        $time            = time() - (60 * 60 * 24 * $f_user_reg_more);
251
        if ($time > 0) {
252
            $criteria->add(new Criteria('user_regdate', $time, '<'));
253
        }
254
    }
255
    if (!empty($_POST['user_reg_less']) && is_numeric($_POST['user_reg_less'])) {
256
        $f_user_reg_less = Request::getInt('user_reg_less', 0, 'POST');
257
        $time            = time() - (60 * 60 * 24 * $f_user_reg_less);
258
        if ($time > 0) {
259
            $criteria->add(new Criteria('user_regdate', $time, '>'));
260
        }
261
    }
262
    if (isset($_POST['user_posts_more']) && is_numeric($_POST['user_posts_more'])) {
263
        $criteria->add(new Criteria('posts', Request::getInt('user_posts_more', 0, 'POST'), '>'));
264
    }
265
    if (!empty($_POST['user_posts_less']) && is_numeric($_POST['user_posts_less'])) {
266
        $criteria->add(new Criteria('posts', Request::getInt('user_posts_less', 0, 'POST'), '<'));
267
    }
268
    $criteria->add(new Criteria('level', 0, '>'));
269
    $validsort = ['uname', 'email', 'last_login', 'user_regdate', 'posts'];
270
    $sort      = !in_array(Request::getString('user_sort', 'uname', 'POST'), $validsort, true);
271
    $order     = 'ASC';
272
    if (isset($_POST['user_order']) && 'DESC' === Request::getString('user_order', '', 'POST')) {
273
        $order = 'DESC';
274
    }
275
    $limit = Request::getInt('limit', 20, 'POST');
276
    if (0 === $limit || $limit > 50) {
277
        $limit = 50;
278
    }
279
    $start         = Request::getInt('start', 0, 'POST');
280
    $memberHandler = xoops_getHandler('member');
281
    $total         = $memberHandler->getUserCount($criteria);
0 ignored issues
show
The method getUserCount() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

281
    /** @scrutinizer ignore-call */ 
282
    $total         = $memberHandler->getUserCount($criteria);
Loading history...
282
    $xoopsTpl->assign('lang_search', _MD_SUICO_SEARCH);
283
    $xoopsTpl->assign('lang_results', _MD_SUICO_RESULTS);
284
    $xoopsTpl->assign('total_found', $total);
285
    if (0 === $total) {
286
        $xoopsTpl->assign('lang_nonefound', _MD_SUICO_NOFOUND);
287
    } elseif ($start < $total) {
288
        $xoopsTpl->assign('lang_username', _MD_SUICO_UNAME);
289
        $xoopsTpl->assign('lang_realname', _MD_SUICO_REALNAME);
290
        $xoopsTpl->assign('lang_avatar', _MD_SUICO_AVATAR);
291
        $xoopsTpl->assign('lang_email', _MD_SUICO_EMAIL);
292
        $xoopsTpl->assign('lang_privmsg', _MD_SUICO_PM);
293
        $xoopsTpl->assign('lang_regdate', _MD_SUICO_REGDATE);
294
        $xoopsTpl->assign('lang_lastlogin', _MD_SUICO_LASTLOGIN);
295
        $xoopsTpl->assign('lang_posts', _MD_SUICO_POSTS);
296
        $xoopsTpl->assign('lang_url', _MD_SUICO_URL);
297
        $xoopsTpl->assign('lang_admin', _MD_SUICO_ADMIN);
298
        if ($iamadmin) {
299
            $xoopsTpl->assign('is_admin', true);
300
        }
301
        $criteria->setSort($sort);
302
        $criteria->setOrder($order);
303
        $criteria->setStart($start);
304
        $criteria->setLimit($limit);
305
        $foundusers = $memberHandler->getUsers($criteria, true);
0 ignored issues
show
The method getUsers() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

305
        /** @scrutinizer ignore-call */ 
306
        $foundusers = $memberHandler->getUsers($criteria, true);
Loading history...
306
        foreach (array_keys($foundusers) as $j) {
307
            $userdata['avatar']   = $foundusers[$j]->getVar('user_avatar');
308
            $userdata['realname'] = $foundusers[$j]->getVar('name');
309
            $userdata['name']     = $foundusers[$j]->getVar('uname');
310
            $userdata['id']       = $foundusers[$j]->getVar('uid');
311
            $userdata['uid']      = $foundusers[$j]->getVar('uid');
312
            $criteria_friends     = new Criteria('friend1_uid', $controller->uidOwner);
313
            $criteriaIsfriend     = new CriteriaCompo(new Criteria('friend2_uid', $userdata['uid']));
314
            $criteriaIsfriend->add($criteria_friends);
315
            $controller->isFriend   = $controller->friendshipsFactory->getCount($criteriaIsfriend);
316
            $userdata['isFriend']   = $controller->isFriend;
317
            $friendrequestFactory   = new FriendrequestHandler($xoopsDB);
318
            $criteria_selfrequest   = new Criteria('friendrequester_uid', $controller->uidOwner);
319
            $criteria_isselfrequest = new CriteriaCompo(new Criteria('friendrequestto_uid', $userdata['uid']));
320
            $criteria_isselfrequest->add($criteria_selfrequest);
321
            $controller->isSelfRequest     = $friendrequestFactory->getCount($criteria_isselfrequest);
322
            $userdata['selffriendrequest'] = $controller->isSelfRequest;
323
            if ($controller->isSelfRequest > 0) {
324
                $xoopsTpl->assign('self_uid', $controller->uidOwner);
325
            }
326
            $xoopsTpl->assign('lang_myfriend', _MD_SUICO_MYFRIEND);
327
            $xoopsTpl->assign('lang_friendrequestsent', _MD_SUICO_FRIENDREQUEST_SENT);
328
            $xoopsTpl->assign('lang_friendshipstatus', _MD_SUICO_FRIENDSHIP_STATUS);
329
            $criteria_otherrequest   = new Criteria('friendrequester_uid', $userdata['uid']);
330
            $criteria_isotherrequest = new CriteriaCompo(new Criteria('friendrequestto_uid', $controller->uidOwner));
331
            $criteria_isotherrequest->add($criteria_otherrequest);
332
            $controller->isOtherRequest     = $friendrequestFactory->getCount($criteria_isotherrequest);
333
            $userdata['otherfriendrequest'] = $controller->isOtherRequest;
334
            if ($controller->isOtherRequest > 0) {
335
                $xoopsTpl->assign('other_uid', $userdata['uid']);
336
            }
337
            if (1 === $foundusers[$j]->getVar('user_viewemail') || $iamadmin) {
338
                $userdata['email']        = "<a href='mailto:" . $foundusers[$j]->getVar(
339
                        'email'
340
                    ) . "'><img src='" . XOOPS_URL . "/images/icons/email.gif' border='0' alt='" . sprintf(
341
                                                _SENDEMAILTO,
342
                                                $foundusers[$j]->getVar('uname', 'E')
343
                                            ) . "'></a>";
344
                $userdata['emailaddress'] = $foundusers[$j]->getVar('email');
345
            } else {
346
                $userdata['email'] = '&nbsp;';
347
            }
348
            if ($xoopsUser) {
349
                $userdata['pmlink'] = "<a href='javascript:openWithSelfMain(\"" . XOOPS_URL . '/pmlite.php?send2=1&amp;to_userid=' . $foundusers[$j]->getVar(
350
                        'uid'
351
                    ) . "\",\"pmlite\",450,370);'><img src='" . XOOPS_URL . "/images/icons/pm.gif' border='0' alt='" . sprintf(
352
                                          _SENDPMTO,
353
                                          $foundusers[$j]->getVar(
354
                                              'uname',
355
                                              'E'
356
                                          )
357
                                      ) . "'></a>";
358
                $userdata['pm']     = $foundusers[$j]->getVar('uid');
359
            } else {
360
                $userdata['pmlink'] = '&nbsp;';
361
            }
362
            if ('' !== $foundusers[$j]->getVar('url', 'E')) {
363
                $userdata['website'] = "<a href='" . $foundusers[$j]->getVar(
364
                        'url',
365
                        'E'
366
                    ) . "' target='_blank'><img src='" . XOOPS_URL . "/images/icons/www.gif' border='0' alt='" . _VISITWEBSITE . "'></a>";
367
            } else {
368
                $userdata['website'] = '&nbsp;';
369
            }
370
            $userdata['url']          = $foundusers[$j]->getVar('url', 'e');
371
            $userdata['registerdate'] = formatTimestamp($foundusers[$j]->getVar('user_regdate'), 's');
372
            if (0 !== $foundusers[$j]->getVar('last_login')) {
373
                $userdata['lastlogin'] = formatTimestamp($foundusers[$j]->getVar('last_login'), 'm');
374
            } else {
375
                $userdata['lastlogin'] = _MD_SUICO_NEVERLOGIN;
376
            }
377
            $userdata['posts'] = $foundusers[$j]->getVar('posts');
378
            if ($iamadmin) {
379
                $userdata['adminlink'] = "<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=users&amp;uid=' . (int)$foundusers[$j]->getVar(
380
                        'uid'
381
                    ) . "&amp;op=modifyUser'>" . _EDIT . "</a>  <a href='" . XOOPS_URL . '/modules/system/admin.php?fct=users&amp;op=delUser&amp;uid=' . (int)$foundusers[$j]->getVar(
382
                        'uid'
383
                    ) . "'>" . _DELETE . '</a>';
384
            }
385
            $userdata['location']     = $foundusers[$j]->getVar('user_from');
386
            $userdata['occupation']   = $foundusers[$j]->getVar('user_occ');
387
            $userdata['interest']     = $foundusers[$j]->getVar('user_intrest');
388
            $userdata['extrainfo']    = $foundusers[$j]->getVar('bio');
389
            $userdata['signature']    = $foundusers[$j]->getVar('user_sig');
390
            $userdata['onlinestatus'] = $foundusers[$j]->isOnline();
391
            $userrank                 = $foundusers[$j]->rank();
392
            if ($userrank['image']) {
393
                $userdata['rankimage'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="">';
394
            }
395
            $userdata['ranktitle'] = $userrank['title'];
396
            $uid                   = $userdata['id'];
397
            $groups                = $memberHandler->getGroupsByUser($uid, true);
0 ignored issues
show
The method getGroupsByUser() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsMembershipHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

397
            /** @scrutinizer ignore-call */ 
398
            $groups                = $memberHandler->getGroupsByUser($uid, true);
Loading history...
398
            $usergroups            = [];
399
            foreach ($groups as $group) {
400
                $usergroups[] = $group->getVar('name');
401
            }
402
            $userdata['groups'] = implode(', ', $usergroups);
403
            $xoopsTpl->append('users', $userdata);
404
        }
405
        $totalpages = ceil($total / $limit);
406
        if ($totalpages > 1) {
407
            $hiddenform = "<form name='findnext' action='searchmembers.php' method='post'>";
408
            foreach ($_POST as $k => $v) {
409
                $hiddenform .= "<input type='hidden' name='" . $myts->htmlSpecialChars($k) . "' value='" . $myts->htmlSpecialChars($v) . "'>\n";
410
            }
411
            if (!isset($_POST['limit'])) {
412
                $hiddenform .= "<input type='hidden' name='limit' value='" . $limit . "'>\n";
413
            }
414
            if (!isset($_POST['start'])) {
415
                $hiddenform .= "<input type='hidden' name='start' value='" . $start . "'>\n";
416
            }
417
            $prev = $start - $limit;
418
            if ($start - $limit >= 0) {
419
                $hiddenform .= "<a href='#0' onclick='document.findnext.start.value=" . $prev . ";document.findnext.submit();'>" . _MD_SUICO_PREVIOUS . "</a>&nbsp;\n";
420
            }
421
            $counter     = 1;
422
            $currentpage = ($start + $limit) / $limit;
423
            while ($counter <= $totalpages) {
424
                if ($counter === $currentpage) {
425
                    $hiddenform .= '<b>' . $counter . '</b> ';
426
                } elseif (($counter > $currentpage - 4 && $counter < $currentpage + 4) || 1 === $counter || $counter === $totalpages) {
427
                    if ($counter === $totalpages && $currentpage < $totalpages - 4) {
428
                        $hiddenform .= '... ';
429
                    }
430
                    $hiddenform .= "<a href='#" . $counter . "' onclick='document.findnext.start.value=" . ($counter - 1) * $limit . ";document.findnext.submit();'>" . $counter . '</a> ';
431
                    if (1 === $counter && $currentpage > 5) {
432
                        $hiddenform .= '... ';
433
                    }
434
                }
435
                $counter++;
436
            }
437
            $next = $start + $limit;
438
            if ($total > $next) {
439
                $hiddenform .= "&nbsp;<a href='#" . $total . "' onclick='document.findnext.start.value=" . $next . ";document.findnext.submit();'>" . _MD_SUICO_NEXT . "</a>\n";
440
            }
441
            $hiddenform .= '</form>';
442
            $xoopsTpl->assign('pagenav', $hiddenform);
443
            $xoopsTpl->assign('lang_numfound', sprintf(_MD_SUICO_USER_SFOUND, $total));
444
        }
445
    }
446
}
447
//requests to become friend
448
$xoopsTpl->assign('lang_askusertobefriend', _MD_SUICO_ASKBEFRIEND);
449
$xoopsTpl->assign('lang_addfriend', _MD_SUICO_ADDFRIEND);
450
$xoopsTpl->assign('lang_friendshippending', _MD_SUICO_FRIENDREQUEST_PENDING);
451
$xoopsTpl->assign('lang_cancelfriendrequest', _MD_SUICO_FRIENDREQUEST_CANCEL);
452
if (isset($_POST['addfriend'])) {
453
    $newFriendrequest = $friendrequestFactory->create(true);
454
    $newFriendrequest->setVar('friendrequester_uid', $controller->uidOwner);
455
    $newFriendrequest->setVar('friendrequestto_uid', 5, 0, 'POST');
456
    $friendrequestFactory->insert2($newFriendrequest);
457
    redirect_header(
458
        XOOPS_URL . '/modules/suico/index.php?uid=' . Request::getInt('friendrequestfrom_uid', 0, 'POST'),
459
        3,
460
        _MD_SUICO_FRIENDREQUEST_FROM
461
    );
462
}
463
$memberHandler = xoops_getHandler('member');
464
$thisUser      = $memberHandler->getUser($controller->uidOwner);
465
$myts          = \MyTextSanitizer::getInstance();
466
//navbar
467
$xoopsTpl->assign('lang_mysection', _MD_SUICO_SEARCH);
468
$xoopsTpl->assign('section_name', _MD_SUICO_SEARCH);
469
// temporary solution for profile module integration
470
if (xoops_isActiveModule('profile')) {
471
    $profileHandler = $helper->getHandler('Profile');
472
    $uid            = $controller->uidOwner;
473
    if ($uid <= 0) {
474
        if (is_object($xoopsUser)) {
475
            $profile = $profileHandler->get($uid);
476
        } else {
477
            header('location: ' . XOOPS_URL);
478
            exit();
479
        }
480
    } else {
481
        $profile = $profileHandler->get($uid);
482
    }
483
}
484
require __DIR__ . '/footer.php';
485
require_once XOOPS_ROOT_PATH . '/footer.php';
486