Passed
Pull Request — master (#103)
by
unknown
03:08
created

searchmembers.php (5 issues)

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

302
    /** @scrutinizer ignore-call */ 
303
    $total         = $memberHandler->getUserCount($criteria);
Loading history...
303
    $xoopsTpl->assign('lang_search', _MD_SUICO_SEARCH);
304
    $xoopsTpl->assign('lang_results', _MD_SUICO_RESULTS);
305
    $xoopsTpl->assign('total_found', $total);
306
    if (0 === $total) {
307
        $xoopsTpl->assign('lang_nonefound', _MD_SUICO_NOFOUND);
308
    } elseif ($start < $total) {
309
        $xoopsTpl->assign('lang_username', _MD_SUICO_UNAME);
310
        $xoopsTpl->assign('lang_realname', _MD_SUICO_REALNAME);
311
        $xoopsTpl->assign('lang_avatar', _MD_SUICO_AVATAR);
312
        $xoopsTpl->assign('lang_email', _MD_SUICO_EMAIL);
313
        $xoopsTpl->assign('lang_privmsg', _MD_SUICO_PM);
314
        $xoopsTpl->assign('lang_regdate', _MD_SUICO_REGDATE);
315
        $xoopsTpl->assign('lang_lastlogin', _MD_SUICO_LASTLOGIN);
316
        $xoopsTpl->assign('lang_posts', _MD_SUICO_POSTS);
317
        $xoopsTpl->assign('lang_url', _MD_SUICO_URL);
318
        $xoopsTpl->assign('lang_admin', _MD_SUICO_ADMIN);
319
        if ($iamadmin) {
320
            $xoopsTpl->assign('is_admin', true);
321
        }
322
        $criteria->setSort($sort);
323
        $criteria->setOrder($order);
324
        $criteria->setStart($start);
325
        $criteria->setLimit($limit);
326
        $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

326
        /** @scrutinizer ignore-call */ 
327
        $foundusers = $memberHandler->getUsers($criteria, true);
Loading history...
327
        foreach (array_keys($foundusers) as $j) {
328
            $userdata['avatar']   = $foundusers[$j]->getVar('user_avatar');
329
            $userdata['realname'] = $foundusers[$j]->getVar('name');
330
            $userdata['name']     = $foundusers[$j]->getVar('uname');
331
            $userdata['id']       = $foundusers[$j]->getVar('uid');
332
            $userdata['uid']      = $foundusers[$j]->getVar('uid');
333
334
            $criteria_friends = new Criteria('friend1_uid', $controller->uidOwner);
335
            $criteriaIsfriend = new CriteriaCompo(new Criteria('friend2_uid', $userdata['uid']));
336
            $criteriaIsfriend->add($criteria_friends);
337
            $controller->isFriend = $controller->friendshipsFactory->getCount($criteria_isfriend);
338
            $userdata['isFriend'] = $controller->isFriend;
339
340
            $friendrequestFactory = new Suico\FriendrequestHandler($xoopsDB);
341
342
            $criteria_selfrequest   = new Criteria('friendrequester_uid', $controller->uidOwner);
343
            $criteria_isselfrequest = new CriteriaCompo(new Criteria('friendrequestto_uid', $userdata['uid']));
344
            $criteria_isselfrequest->add($criteria_selfrequest);
345
            $controller->isSelfRequest     = $friendrequestFactory->getCount($criteria_isselfrequest);
346
            $userdata['selffriendrequest'] = $controller->isSelfRequest;
347
            if ($controller->isSelfRequest > 0) {
348
                $xoopsTpl->assign('self_uid', $controller->uidOwner);
349
            }
350
            $xoopsTpl->assign('lang_myfriend', _MD_SUICO_MYFRIEND);
351
            $xoopsTpl->assign('lang_friendrequestsent', _MD_SUICO_FRIENDREQUEST_SENT);
352
            $xoopsTpl->assign('lang_friendshipstatus', _MD_SUICO_FRIENDSHIP_STATUS);
353
354
            $criteria_otherrequest   = new Criteria('friendrequester_uid', $userdata['uid']);
355
            $criteria_isotherrequest = new CriteriaCompo(new Criteria('friendrequestto_uid', $controller->uidOwner));
356
            $criteria_isotherrequest->add($criteria_otherrequest);
357
            $controller->isOtherRequest     = $friendrequestFactory->getCount($criteria_isotherrequest);
358
            $userdata['otherfriendrequest'] = $controller->isOtherRequest;
359
            if ($controller->isOtherRequest > 0) {
360
                $xoopsTpl->assign('other_uid', $userdata['uid']);
361
            }
362
363
            if (1 === $foundusers[$j]->getVar('user_viewemail') || $iamadmin) {
364
                $userdata['email']        = "<a href='mailto:" . $foundusers[$j]->getVar(
365
                        'email'
366
                    ) . "'><img src='" . XOOPS_URL . "/images/icons/email.gif' border='0' alt='" . sprintf(
367
                                                _SENDEMAILTO,
368
                                                $foundusers[$j]->getVar('uname', 'E')
369
                                            ) . "'></a>";
370
                $userdata['emailaddress'] = $foundusers[$j]->getVar('email');
371
            } else {
372
                $userdata['email'] = '&nbsp;';
373
            }
374
            if ($xoopsUser) {
375
                $userdata['pmlink'] = "<a href='javascript:openWithSelfMain(\"" . XOOPS_URL . '/pmlite.php?send2=1&amp;to_userid=' . $foundusers[$j]->getVar(
376
                        'uid'
377
                    ) . "\",\"pmlite\",450,370);'><img src='" . XOOPS_URL . "/images/icons/pm.gif' border='0' alt='" . sprintf(
378
                                          _SENDPMTO,
379
                                          $foundusers[$j]->getVar(
380
                                              'uname',
381
                                              'E'
382
                                          )
383
                                      ) . "'></a>";
384
                $userdata['pm']     = $foundusers[$j]->getVar('uid');
385
            } else {
386
                $userdata['pmlink'] = '&nbsp;';
387
            }
388
389
            if ('' !== $foundusers[$j]->getVar('url', 'E')) {
390
                $userdata['website'] = "<a href='" . $foundusers[$j]->getVar(
391
                        'url',
392
                        'E'
393
                    ) . "' target='_blank'><img src='" . XOOPS_URL . "/images/icons/www.gif' border='0' alt='" . _VISITWEBSITE . "'></a>";
394
            } else {
395
                $userdata['website'] = '&nbsp;';
396
            }
397
            $userdata['url']          = $foundusers[$j]->getVar('url', 'e');
398
            $userdata['registerdate'] = formatTimestamp($foundusers[$j]->getVar('user_regdate'), 's');
399
            if (0 !== $foundusers[$j]->getVar('last_login')) {
400
                $userdata['lastlogin'] = formatTimestamp($foundusers[$j]->getVar('last_login'), 'm');
401
            } else {
402
                $userdata['lastlogin'] = _MD_SUICO_NEVERLOGIN;
403
            }
404
            $userdata['posts'] = $foundusers[$j]->getVar('posts');
405
            if ($iamadmin) {
406
                $userdata['adminlink'] = "<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=users&amp;uid=' . (int)$foundusers[$j]->getVar(
407
                        'uid'
408
                    ) . "&amp;op=modifyUser'>" . _EDIT . "</a>  <a href='" . XOOPS_URL . '/modules/system/admin.php?fct=users&amp;op=delUser&amp;uid=' . (int)$foundusers[$j]->getVar(
409
                        'uid'
410
                    ) . "'>" . _DELETE . '</a>';
411
            }
412
413
            $userdata['location']     = $foundusers[$j]->getVar('user_from');
414
            $userdata['occupation']   = $foundusers[$j]->getVar('user_occ');
415
            $userdata['interest']     = $foundusers[$j]->getVar('user_intrest');
416
            $userdata['extrainfo']    = $foundusers[$j]->getVar('bio');
417
            $userdata['signature']    = $foundusers[$j]->getVar('user_sig');
418
            $userdata['onlinestatus'] = $foundusers[$j]->isOnline();
419
            $userrank                 = $foundusers[$j]->rank();
420
            if ($userrank['image']) {
421
                $userdata['rankimage'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="">';
422
            }
423
            $userdata['ranktitle'] = $userrank['title'];
424
425
            $uid        = $userdata['id'];
426
            $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

426
            /** @scrutinizer ignore-call */ 
427
            $groups     = $memberHandler->getGroupsByUser($uid, true);
Loading history...
427
            $usergroups = [];
428
            foreach ($groups as $group) {
429
                $usergroups[] = $group->getVar('name');
430
            }
431
            $userdata['groups'] = implode(', ', $usergroups);
432
433
            $xoopsTpl->append('users', $userdata);
434
        }
435
        $totalpages = ceil($total / $limit);
436
        if ($totalpages > 1) {
437
            $hiddenform = "<form name='findnext' action='searchmembers.php' method='post'>";
438
            foreach ($_POST as $k => $v) {
439
                $hiddenform .= "<input type='hidden' name='" . $myts->htmlSpecialChars($k) . "' value='" . $myts->htmlSpecialChars($v) . "'>\n";
440
            }
441
            if (!isset($_POST['limit'])) {
442
                $hiddenform .= "<input type='hidden' name='limit' value='" . $limit . "'>\n";
443
            }
444
            if (!isset($_POST['start'])) {
445
                $hiddenform .= "<input type='hidden' name='start' value='" . $start . "'>\n";
446
            }
447
            $prev = $start - $limit;
448
            if ($start - $limit >= 0) {
449
                $hiddenform .= "<a href='#0' onclick='document.findnext.start.value=" . $prev . ";document.findnext.submit();'>" . _MD_SUICO_PREVIOUS . "</a>&nbsp;\n";
450
            }
451
            $counter     = 1;
452
            $currentpage = ($start + $limit) / $limit;
453
            while ($counter <= $totalpages) {
454
                if ($counter === $currentpage) {
455
                    $hiddenform .= '<b>' . $counter . '</b> ';
456
                } elseif (($counter > $currentpage - 4 && $counter < $currentpage + 4) || 1 === $counter || $counter === $totalpages) {
457
                    if ($counter === $totalpages && $currentpage < $totalpages - 4) {
458
                        $hiddenform .= '... ';
459
                    }
460
                    $hiddenform .= "<a href='#" . $counter . "' onclick='document.findnext.start.value=" . ($counter - 1) * $limit . ";document.findnext.submit();'>" . $counter . '</a> ';
0 ignored issues
show
Are you sure $counter of type void can be used in concatenation? ( Ignorable by Annotation )

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

460
                    $hiddenform .= "<a href='#" . /** @scrutinizer ignore-type */ $counter . "' onclick='document.findnext.start.value=" . ($counter - 1) * $limit . ";document.findnext.submit();'>" . $counter . '</a> ';
Loading history...
461
                    if (1 === $counter && $currentpage > 5) {
462
                        $hiddenform .= '... ';
463
                    }
464
                }
465
                $counter++;
466
            }
467
            $next = $start + $limit;
468
            if ($total > $next) {
469
                $hiddenform .= "&nbsp;<a href='#" . $total . "' onclick='document.findnext.start.value=" . $next . ";document.findnext.submit();'>" . _MD_SUICO_NEXT . "</a>\n";
470
            }
471
            $hiddenform .= '</form>';
472
            $xoopsTpl->assign('pagenav', $hiddenform);
473
            $xoopsTpl->assign('lang_numfound', sprintf(_MD_SUICO_USER_SFOUND, $total));
474
        }
475
    }
476
}
477
478
//requests to become friend
479
480
$xoopsTpl->assign('lang_askusertobefriend', _MD_SUICO_ASKBEFRIEND);
481
$xoopsTpl->assign('lang_addfriend', _MD_SUICO_ADDFRIEND);
482
$xoopsTpl->assign('lang_friendshippending', _MD_SUICO_FRIENDREQUEST_PENDING);
483
$xoopsTpl->assign('lang_cancelfriendrequest', _MD_SUICO_FRIENDREQUEST_CANCEL);
484
485
if (isset($_POST['addfriend'])) {
486
    $newFriendrequest = $friendrequestFactory->create(true);
487
    $newFriendrequest->setVar('friendrequester_uid', $controller->uidOwner);
488
    $newFriendrequest->setVar('friendrequestto_uid', 5, 0, 'POST');
489
    $friendrequestFactory->insert2($newFriendrequest);
490
    redirect_header(
491
        XOOPS_URL . '/modules/suico/index.php?uid=' . Request::getInt('friendrequestfrom_uid', 0, 'POST'),
492
        3,
493
        _MD_SUICO_FRIENDREQUEST_FROM
494
    );
495
}
496
497
$memberHandler = xoops_getHandler('member');
498
$thisUser      = $memberHandler->getUser($controller->uidOwner);
0 ignored issues
show
The method getUser() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsAvatarHandler 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

498
$thisUser      = $memberHandler->/** @scrutinizer ignore-call */ getUser($controller->uidOwner);
Loading history...
499
$myts          = MyTextSanitizer::getInstance();
500
501
//navbar
502
$xoopsTpl->assign('lang_mysection', _MD_SUICO_SEARCH);
503
$xoopsTpl->assign('section_name', _MD_SUICO_SEARCH);
504
505
// temporary solution for profile module integration
506
if (xoops_isActiveModule('profile')) {
507
    $profileHandler = $helper->getHandler('Profile');
508
    $uid            = $controller->uidOwner;
509
    if ($uid <= 0) {
510
        if (is_object($xoopsUser)) {
511
            $profile = $profileHandler->get($uid);
512
        } else {
513
            header('location: ' . XOOPS_URL);
514
            exit();
515
        }
516
    } else {
517
        $profile = $profileHandler->get($uid);
518
    }
519
}
520
521
require __DIR__ . '/footer.php';
522
require_once XOOPS_ROOT_PATH . '/footer.php';
523