Passed
Push — master ( 7c9d88...a7d412 )
by Michael
03:18 queued 10s
created

searchmembers.php (5 issues)

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
31
require __DIR__ . '/header.php';
32
$op = Request::getCmd('op', 'form', 'POST');
33
//require_once __DIR__ . '/class/suico_controller.php';
34
$controller = new Suico\IndexController($xoopsDB, $xoopsUser);
35
/**
36
 * Fetching numbers of groups friends videos pictures etc...
37
 */
38
$nbSections = $controller->getNumbersSections();
39
if ('form' === $op) {
40
    $GLOBALS['xoopsOption']['template_main'] = 'suico_searchform.tpl';
41
    require XOOPS_ROOT_PATH . '/header.php';
42
    /** @var \XoopsMemberHandler $memberHandler */
43
    $memberHandler = xoops_getHandler('member');
44
    $total         = $memberHandler->getUserCount(new Criteria('level', 0, '>'));
45
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
46
    $uname_text  = new XoopsFormText('', 'user_uname', 30, 60);
47
    $uname_match = new XoopsFormSelectMatchOption('', 'user_uname_match');
48
    $uname_tray  = new XoopsFormElementTray(_MD_SUICO_UNAME, '&nbsp;');
49
    $uname_tray->addElement($uname_match);
50
    $uname_tray->addElement($uname_text);
51
    $name_text  = new XoopsFormText('', 'user_name', 30, 60);
52
    $name_match = new XoopsFormSelectMatchOption('', 'user_name_match');
53
    $name_tray  = new XoopsFormElementTray(_MD_SUICO_REALNAME, '&nbsp;');
54
    $name_tray->addElement($name_match);
55
    $name_tray->addElement($name_text);
56
    $email_text  = new XoopsFormText('', 'user_email', 30, 60);
57
    $email_match = new XoopsFormSelectMatchOption('', 'user_email_match');
58
    $email_tray  = new XoopsFormElementTray(_MD_SUICO_EMAIL, '&nbsp;');
59
    $email_tray->addElement($email_match);
60
    $email_tray->addElement($email_text);
61
    $url_text        = new XoopsFormText(_MD_SUICO_URL_CONTAINS, 'user_url', 30, 100);
62
    $location_text   = new XoopsFormText(_MD_SUICO_LOCATION_CONTAINS, 'user_from', 30, 100);
63
    $occupation_text = new XoopsFormText(_MD_SUICO_OCCUPATION_CONTAINS, 'user_occ', 30, 100);
64
    $interest_text   = new XoopsFormText(_MD_SUICO_INTEREST_CONTAINS, 'user_intrest', 30, 100);
65
    $extrainfo_text  = new XoopsFormText(_MD_SUICO_EXTRAINFO_CONTAINS, 'bio', 30, 100);
66
    $signature_text  = new XoopsFormText(_MD_SUICO_SIGNATURE_CONTAINS, 'user_sig', 30, 100);
67
    $lastlog_more    = new XoopsFormText(
68
        _MD_SUICO_LASTLOGMORE, 'user_lastlog_more', 10, 5
69
    );
70
    $lastlog_less    = new XoopsFormText(_MD_SUICO_LASTLOGLESS, 'user_lastlog_less', 10, 5);
71
    $reg_more        = new XoopsFormText(_MD_SUICO_REGMORE, 'user_reg_more', 10, 5);
72
    $reg_less        = new XoopsFormText(_MD_SUICO_REGLESS, 'user_reg_less', 10, 5);
73
    $posts_more      = new XoopsFormText(_MD_SUICO_POSTSMORE, 'user_posts_more', 10, 5);
74
    $posts_less      = new XoopsFormText(_MD_SUICO_POSTSLESS, 'user_posts_less', 10, 5);
75
    $sort_select     = new XoopsFormSelect(_MD_SUICO_SORT, 'user_sort');
76
    $sort_select->addOptionArray(
77
        [
78
            'uname'        => _MD_SUICO_UNAME,
79
            'email'        => _MD_SUICO_EMAIL,
80
            'last_login'   => _MD_SUICO_LASTLOGIN,
81
            'user_regdate' => _MD_SUICO_REGDATE,
82
            'posts'        => _MD_SUICO_POSTS,
83
        ]
84
    );
85
    $order_select = new XoopsFormSelect(_MD_SUICO_ORDER, 'user_order');
86
    $order_select->addOptionArray(
87
        [
88
            'ASC'  => _MD_SUICO_ASC,
89
            'DESC' => _MD_SUICO_DESC,
90
        ]
91
    );
92
    $limit_text    = new XoopsFormText(_MD_SUICO_LIMIT, 'limit', 6, 2);
93
    $op_hidden     = new XoopsFormHidden('op', 'submit');
94
    $submit_button = new XoopsFormButton('', 'user_submit', _SUBMIT, 'submit');
95
    $form          = new XoopsThemeForm('', 'searchform', 'searchmembers.php');
96
    $form->addElement($uname_tray);
97
    $form->addElement($name_tray);
98
    $form->addElement($email_tray);
99
    if (1 == $xoopsModuleConfig['displayurl']) {
100
        $form->addElement($url_text);
101
    }
102
    if (1 == $xoopsModuleConfig['displayfrom']) {
103
        $form->addElement($location_text);
104
    }
105
    if (1 == $xoopsModuleConfig['displayoccupation']) {
106
        $form->addElement($occupation_text);
107
    }
108
    if (1 == $xoopsModuleConfig['displayinterest']) {
109
        $form->addElement($interest_text);
110
    }
111
    if (1 == $xoopsModuleConfig['displayextrainfo']) {
112
        $form->addElement($extrainfo_text);
113
    }
114
    if (1 == $xoopsModuleConfig['displaysignature']) {
115
        $form->addElement($signature_text);
116
    }
117
    if (1 == $xoopsModuleConfig['displaylastlogin']) {
118
        $form->addElement($lastlog_more);
119
        $form->addElement($lastlog_less);
120
    }
121
    if (1 == $xoopsModuleConfig['displayregdate']) {
122
        $form->addElement($reg_more);
123
        $form->addElement($reg_less);
124
    }
125
    if (1 == $xoopsModuleConfig['displayposts']) {
126
        $form->addElement($posts_more);
127
        $form->addElement($posts_less);
128
    }
129
    $form->addElement($sort_select);
130
    $form->addElement($order_select);
131
    $form->addElement($limit_text);
132
    $form->addElement($op_hidden);
133
    $form->addElement($submit_button);
134
    $form->assign($xoopsTpl);
135
    $xoopsTpl->assign('lang_search', _MD_SUICO_SEARCH);
136
    $xoopsTpl->assign(
137
        'lang_totalusers',
138
        sprintf(_MD_SUICO_TOTALUSERS, '<span style="color:#ff0000;">' . $total . '</span>')
139
    );
140
    $xoopsTpl->assign('totalmember', $total);
141
}
142
if ('submit' === $op) {
143
    $GLOBALS['xoopsOption']['template_main'] = 'suico_searchresults.tpl';
144
    require XOOPS_ROOT_PATH . '/header.php';
145
    $iamadmin = $xoopsUserIsAdmin;
146
    $myts     = MyTextSanitizer::getInstance();
147
    $criteria = new CriteriaCompo();
148
    if (!empty($_POST['user_uname'])) {
149
        $match = !empty($_POST['user_uname_match']) ? Request::getInt('user_uname_match', 0, 'POST') : XOOPS_MATCH_START;
150
        switch ($match) {
151
            case XOOPS_MATCH_START:
152
                $criteria->add(new Criteria('uname', Request::getString('user_uname', '', 'POST') . '%', 'LIKE'));
153
                break;
154
            case XOOPS_MATCH_END:
155
                $criteria->add(new Criteria('uname', '%' . Request::getString('user_uname', '', 'POST'), 'LIKE'));
156
                break;
157
            case XOOPS_MATCH_EQUAL:
158
                $criteria->add(new Criteria('uname', Request::getString('user_uname', '', 'POST')));
159
                break;
160
            case XOOPS_MATCH_CONTAIN:
161
                $criteria->add(
162
                    new Criteria('uname', '%' . Request::getString('user_uname', '', 'POST') . '%', 'LIKE')
163
                );
164
                break;
165
        }
166
    }
167
    if (!empty($_POST['user_name'])) {
168
        $match = !empty($_POST['user_name_match']) ? Request::getInt('user_name_match', 0, 'POST') : XOOPS_MATCH_START;
169
        switch ($match) {
170
            case XOOPS_MATCH_START:
171
                $criteria->add(new Criteria('name', Request::getString('user_uname', '', 'POST') . '%', 'LIKE'));
172
                break;
173
            case XOOPS_MATCH_END:
174
                $criteria->add(
175
                    new Criteria('name', '%' . Request::getString('user_uname', '', 'POST') . '%', 'LIKE')
176
                );
177
                break;
178
            case XOOPS_MATCH_EQUAL:
179
                $criteria->add(new Criteria('name', Request::getString('user_uname', '', 'POST')));
180
                break;
181
            case XOOPS_MATCH_CONTAIN:
182
                $criteria->add(
183
                    new Criteria('name', '%' . Request::getString('user_uname', '', 'POST') . '%', 'LIKE')
184
                );
185
                break;
186
        }
187
    }
188
    if (!empty($_POST['user_email'])) {
189
        $match = !empty($_POST['user_email_match']) ? Request::getInt('user_email_match', 0, 'POST') : XOOPS_MATCH_START;
190
        switch ($match) {
191
            case XOOPS_MATCH_START:
192
                $criteria->add(new Criteria('email', Request::getString('user_email', '', 'POST') . '%', 'LIKE'));
193
                break;
194
            case XOOPS_MATCH_END:
195
                $criteria->add(new Criteria('email', '%' . Request::getString('user_email', '', 'POST'), 'LIKE'));
196
                break;
197
            case XOOPS_MATCH_EQUAL:
198
                $criteria->add(new Criteria('email', Request::getString('user_email', '', 'POST')));
199
                break;
200
            case XOOPS_MATCH_CONTAIN:
201
                $criteria->add(
202
                    new Criteria('email', '%' . Request::getString('user_email', '', 'POST') . '%', 'LIKE')
203
                );
204
                break;
205
        }
206
        if (!$iamadmin) {
207
            $criteria->add(new Criteria('user_viewemail', 1));
208
        }
209
    }
210
    if (!empty($_POST['user_url'])) {
211
        //        $url = Request::getUrl('user_url', '', 'POST');
212
        $criteria->add(new Criteria('url', Request::getUrl('user_url', '', 'POST') . '%', 'LIKE'));
213
    }
214
    if (!empty($_POST['user_from'])) {
215
        $criteria->add(new Criteria('user_from', '%' . Request::getString('user_from', '', 'POST') . '%', 'LIKE'));
216
    }
217
    if (!empty($_POST['user_intrest'])) {
218
        $criteria->add(
219
            new Criteria('user_intrest', '%' . Request::getString('user_intrest', '', 'POST') . '%', 'LIKE')
220
        );
221
    }
222
    if (!empty($_POST['user_occ'])) {
223
        $criteria->add(new Criteria('user_occ', '%' . Request::getString('user_occ', '', 'POST') . '%', 'LIKE'));
224
    }
225
    if (!empty($_POST['bio'])) {
226
        $criteria->add(new Criteria('bio', '%' . Request::getString('bio', '', 'POST') . '%', 'LIKE'));
227
    }
228
    if (!empty($_POST['user_sig'])) {
229
        $criteria->add(new Criteria('user_sig', '%' . Request::getString('user_sig', '', 'POST') . '%', 'LIKE'));
230
    }
231
    if (!empty($_POST['user_lastlog_more']) && is_numeric($_POST['user_lastlog_more'])) {
232
        $f_user_lastlog_more = Request::getInt('user_lastlog_more', 0, 'POST');
233
        $time                = time() - (60 * 60 * 24 * $f_user_lastlog_more);
234
        if ($time > 0) {
235
            $criteria->add(new Criteria('last_login', $time, '<'));
236
        }
237
    }
238
    if (!empty($_POST['user_lastlog_less']) && is_numeric($_POST['user_lastlog_less'])) {
239
        $f_user_lastlog_less = Request::getInt('user_lastlog_less', 0, 'POST');
240
        $time                = time() - (60 * 60 * 24 * $f_user_lastlog_less);
241
        if ($time > 0) {
242
            $criteria->add(new Criteria('last_login', $time, '>'));
243
        }
244
    }
245
    if (!empty($_POST['user_reg_more']) && is_numeric($_POST['user_reg_more'])) {
246
        $f_user_reg_more = Request::getInt('user_reg_more', 0, 'POST');
247
        $time            = time() - (60 * 60 * 24 * $f_user_reg_more);
248
        if ($time > 0) {
249
            $criteria->add(new Criteria('user_regdate', $time, '<'));
250
        }
251
    }
252
    if (!empty($_POST['user_reg_less']) && is_numeric($_POST['user_reg_less'])) {
253
        $f_user_reg_less = Request::getInt('user_reg_less', 0, 'POST');
254
        $time            = time() - (60 * 60 * 24 * $f_user_reg_less);
255
        if ($time > 0) {
256
            $criteria->add(new Criteria('user_regdate', $time, '>'));
257
        }
258
    }
259
    if (isset($_POST['user_posts_more']) && is_numeric($_POST['user_posts_more'])) {
260
        $criteria->add(new Criteria('posts', Request::getInt('user_posts_more', 0, 'POST'), '>'));
261
    }
262
    if (!empty($_POST['user_posts_less']) && is_numeric($_POST['user_posts_less'])) {
263
        $criteria->add(new Criteria('posts', Request::getInt('user_posts_less', 0, 'POST'), '<'));
264
    }
265
    $criteria->add(new Criteria('level', 0, '>'));
266
    $validsort = ['uname', 'email', 'last_login', 'user_regdate', 'posts'];
267
    $sort      = !in_array(Request::getString('user_sort', 'uname', 'POST'), $validsort, true);
268
    $order     = 'ASC';
269
    if (isset($_POST['user_order']) && 'DESC' === Request::getString('user_order', '', 'POST')) {
270
        $order = 'DESC';
271
    }
272
    $limit = Request::getInt('limit', 20, 'POST');
273
    if (0 === $limit || $limit > 50) {
274
        $limit = 50;
275
    }
276
    $start         = Request::getInt('start', 0, 'POST');
277
    $memberHandler = xoops_getHandler('member');
278
    $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

278
    /** @scrutinizer ignore-call */ 
279
    $total         = $memberHandler->getUserCount($criteria);
Loading history...
279
    $xoopsTpl->assign('lang_search', _MD_SUICO_SEARCH);
280
    $xoopsTpl->assign('lang_results', _MD_SUICO_RESULTS);
281
    $xoopsTpl->assign('total_found', $total);
282
    if (0 === $total) {
283
        $xoopsTpl->assign('lang_nonefound', _MD_SUICO_NOFOUND);
284
    } elseif ($start < $total) {
285
        $xoopsTpl->assign('lang_username', _MD_SUICO_UNAME);
286
        $xoopsTpl->assign('lang_realname', _MD_SUICO_REALNAME);
287
        $xoopsTpl->assign('lang_avatar', _MD_SUICO_AVATAR);
288
        $xoopsTpl->assign('lang_email', _MD_SUICO_EMAIL);
289
        $xoopsTpl->assign('lang_privmsg', _MD_SUICO_PM);
290
        $xoopsTpl->assign('lang_regdate', _MD_SUICO_REGDATE);
291
        $xoopsTpl->assign('lang_lastlogin', _MD_SUICO_LASTLOGIN);
292
        $xoopsTpl->assign('lang_posts', _MD_SUICO_POSTS);
293
        $xoopsTpl->assign('lang_url', _MD_SUICO_URL);
294
        $xoopsTpl->assign('lang_admin', _MD_SUICO_ADMIN);
295
        if ($iamadmin) {
296
            $xoopsTpl->assign('is_admin', true);
297
        }
298
        $criteria->setSort($sort);
299
        $criteria->setOrder($order);
300
        $criteria->setStart($start);
301
        $criteria->setLimit($limit);
302
        $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

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

394
            /** @scrutinizer ignore-call */ 
395
            $groups                = $memberHandler->getGroupsByUser($uid, true);
Loading history...
395
            $usergroups            = [];
396
            foreach ($groups as $group) {
397
                $usergroups[] = $group->getVar('name');
398
            }
399
            $userdata['groups'] = implode(', ', $usergroups);
400
            $xoopsTpl->append('users', $userdata);
401
        }
402
        $totalpages = ceil($total / $limit);
403
        if ($totalpages > 1) {
404
            $hiddenform = "<form name='findnext' action='searchmembers.php' method='post'>";
405
            foreach ($_POST as $k => $v) {
406
                $hiddenform .= "<input type='hidden' name='" . $myts->htmlSpecialChars($k) . "' value='" . $myts->htmlSpecialChars($v) . "'>\n";
407
            }
408
            if (!isset($_POST['limit'])) {
409
                $hiddenform .= "<input type='hidden' name='limit' value='" . $limit . "'>\n";
410
            }
411
            if (!isset($_POST['start'])) {
412
                $hiddenform .= "<input type='hidden' name='start' value='" . $start . "'>\n";
413
            }
414
            $prev = $start - $limit;
415
            if ($start - $limit >= 0) {
416
                $hiddenform .= "<a href='#0' onclick='document.findnext.start.value=" . $prev . ";document.findnext.submit();'>" . _MD_SUICO_PREVIOUS . "</a>&nbsp;\n";
417
            }
418
            $counter     = 1;
419
            $currentpage = ($start + $limit) / $limit;
420
            while ($counter <= $totalpages) {
421
                if ($counter === $currentpage) {
422
                    $hiddenform .= '<b>' . $counter . '</b> ';
423
                } elseif (($counter > $currentpage - 4 && $counter < $currentpage + 4) || 1 === $counter || $counter === $totalpages) {
424
                    if ($counter === $totalpages && $currentpage < $totalpages - 4) {
425
                        $hiddenform .= '... ';
426
                    }
427
                    $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

427
                    $hiddenform .= "<a href='#" . /** @scrutinizer ignore-type */ $counter . "' onclick='document.findnext.start.value=" . ($counter - 1) * $limit . ";document.findnext.submit();'>" . $counter . '</a> ';
Loading history...
428
                    if (1 === $counter && $currentpage > 5) {
429
                        $hiddenform .= '... ';
430
                    }
431
                }
432
                $counter++;
433
            }
434
            $next = $start + $limit;
435
            if ($total > $next) {
436
                $hiddenform .= "&nbsp;<a href='#" . $total . "' onclick='document.findnext.start.value=" . $next . ";document.findnext.submit();'>" . _MD_SUICO_NEXT . "</a>\n";
437
            }
438
            $hiddenform .= '</form>';
439
            $xoopsTpl->assign('pagenav', $hiddenform);
440
            $xoopsTpl->assign('lang_numfound', sprintf(_MD_SUICO_USER_SFOUND, $total));
441
        }
442
    }
443
}
444
//requests to become friend
445
$xoopsTpl->assign('lang_askusertobefriend', _MD_SUICO_ASKBEFRIEND);
446
$xoopsTpl->assign('lang_addfriend', _MD_SUICO_ADDFRIEND);
447
$xoopsTpl->assign('lang_friendshippending', _MD_SUICO_FRIENDREQUEST_PENDING);
448
$xoopsTpl->assign('lang_cancelfriendrequest', _MD_SUICO_FRIENDREQUEST_CANCEL);
449
if (isset($_POST['addfriend'])) {
450
    $newFriendrequest = $friendrequestFactory->create(true);
451
    $newFriendrequest->setVar('friendrequester_uid', $controller->uidOwner);
452
    $newFriendrequest->setVar('friendrequestto_uid', 5, 0, 'POST');
453
    $friendrequestFactory->insert2($newFriendrequest);
454
    redirect_header(
455
        XOOPS_URL . '/modules/suico/index.php?uid=' . Request::getInt('friendrequestfrom_uid', 0, 'POST'),
456
        3,
457
        _MD_SUICO_FRIENDREQUEST_FROM
458
    );
459
}
460
$memberHandler = xoops_getHandler('member');
461
$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

461
$thisUser      = $memberHandler->/** @scrutinizer ignore-call */ getUser($controller->uidOwner);
Loading history...
462
$myts          = MyTextSanitizer::getInstance();
463
//navbar
464
$xoopsTpl->assign('lang_mysection', _MD_SUICO_SEARCH);
465
$xoopsTpl->assign('section_name', _MD_SUICO_SEARCH);
466
// temporary solution for profile module integration
467
if (xoops_isActiveModule('profile')) {
468
    $profileHandler = $helper->getHandler('Profile');
469
    $uid            = $controller->uidOwner;
470
    if ($uid <= 0) {
471
        if (is_object($xoopsUser)) {
472
            $profile = $profileHandler->get($uid);
473
        } else {
474
            header('location: ' . XOOPS_URL);
475
            exit();
476
        }
477
    } else {
478
        $profile = $profileHandler->get($uid);
479
    }
480
}
481
require __DIR__ . '/footer.php';
482
require_once XOOPS_ROOT_PATH . '/footer.php';
483