Passed
Push — master ( f0fd80...9c2eb6 )
by Michael
33s queued 12s
created

index.php (6 issues)

1
<?php
2
3
declare(strict_types=1);
4
/*
5
 You may not change or alter any portion of this comment or credits
6
 of supporting developers from this source code or any supporting source code
7
 which is considered copyrighted (c) material of the original comment or credit authors.
8
9
 This program is distributed in the hope that it will be useful,
10
 but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
*/
13
14
/**
15
 * @category        Module
16
 * @package         suico
17
 * @copyright       {@link https://xoops.org/ XOOPS Project}
18
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
19
 * @author          Marcello Brandão aka  Suico, Mamba, LioMJ  <https://xoops.org>
20
 */
21
22
use Xmf\Request;
23
use XoopsModules\Suico\{
24
    FriendsController,
25
    IndexController
26
};
27
28
/**
29
 * Xoops header
30
 */
31
$GLOBALS['xoopsOption']['template_main'] = 'suico_index.tpl';
32
require __DIR__ . '/header.php';
33
$helper->loadLanguage('user');
34
$controller = new IndexController($xoopsDB, $xoopsUser);
35
/**
36
 * Fetching numbers of groups friends videos pictures etc...
37
 */
38
$nbSections = $controller->getNumbersSections();
39
$uid        = $controller->uidOwner;
40
$categories = [];
41
/* @var  \XoopsGroupPermHandler $grouppermHandler */
42
$grouppermHandler = xoops_getHandler('groupperm');
43
$groups           = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : [XOOPS_GROUP_ANONYMOUS];
44
if (is_object($GLOBALS['xoopsUser']) && $uid == $GLOBALS['xoopsUser']->getVar('uid')) {
45
    //disable cache
46
    $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
47
    //    include $GLOBALS['xoops']->path('header.php');
48
    /* @var XoopsConfigHandler $configHandler */
49
    $configHandler              = xoops_getHandler('config');
50
    $GLOBALS['xoopsConfigUser'] = $configHandler->getConfigsByCat(XOOPS_CONF_USER);
51
    $GLOBALS['xoopsTpl']->assign('user_ownpage', true);
52
    if (1 == $GLOBALS['xoopsConfigUser']['self_delete']) {
53
        $GLOBALS['xoopsTpl']->assign('user_candelete', true);
54
        $GLOBALS['xoopsTpl']->assign('lang_deleteaccount', _US_DELACCOUNT);
55
    } else {
56
        $GLOBALS['xoopsTpl']->assign('user_candelete', false);
57
    }
58
    $GLOBALS['xoopsTpl']->assign('user_changeemail', $GLOBALS['xoopsConfigUser']['allow_chgmail']);
59
    $thisUser = &$GLOBALS['xoopsUser'];
60
} else {
61
    /* @var XoopsMemberHandler $memberHandler */
62
    $memberHandler = xoops_getHandler('member');
63
    $thisUser      = $memberHandler->getUser($uid);
64
    // Redirect if not a user or not active and the current user is not admin
65
    if (!is_object($thisUser) || (!$thisUser->isActive() && (!$GLOBALS['xoopsUser'] || !$GLOBALS['xoopsUser']->isAdmin()))) {
66
        redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n'), 3, _US_SELECTNG);
67
    }
68
    /**
69
     * Access permission check
70
     *
71
     * Note:
72
     * "thisUser" refers to the user whose profile will be accessed; "xoopsUser" refers to the current user $GLOBALS['xoopsUser']
73
     * "Basic Groups" refer to XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS and XOOPS_GROUP_ANONYMOUS;
74
     * "Non Basic Groups" refer to all other custom groups
75
     *
76
     * Admin groups: If thisUser belongs to admin groups, the xoopsUser has access if and only if one of xoopsUser's groups is allowed to access admin group; else
77
     * Non basic groups: If thisUser belongs to one or more non basic groups, the xoopsUser has access if and only if one of xoopsUser's groups is allowed to allowed to any of the non basic groups; else
78
     * User group: If thisUser belongs to User group only, the xoopsUser has access if and only if one of his groups is allowed to access User group
79
     */
80
    // Redirect if current user is not allowed to access the user's profile based on group permission
81
    $groups_basic             = [XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS, XOOPS_GROUP_ANONYMOUS];
82
    $groups_thisUser          = $thisUser->getGroups();
83
    $groups_thisUser_nonbasic = array_diff($groups_thisUser, $groups_basic);
84
    $groups_xoopsUser         = $groups;
85
    /* @var  XoopsGroupPermHandler $grouppermHandler */
86
    $grouppermHandler  = xoops_getHandler('groupperm');
87
    $groups_accessible = $grouppermHandler->getItemIds('profile_access', $groups_xoopsUser, $helper->getModule()->getVar('mid'));
88
    $rejected          = false;
89
    if ($thisUser->isAdmin()) {
90
        $rejected = !in_array(XOOPS_GROUP_ADMIN, $groups_accessible);
91
    } elseif ($groups_thisUser_nonbasic) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $groups_thisUser_nonbasic of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
92
        $rejected = !array_intersect($groups_thisUser_nonbasic, $groups_accessible);
93
    } else {
94
        $rejected = !in_array(XOOPS_GROUP_USERS, $groups_accessible);
95
    }
96
    if ($rejected) {
97
        // redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n'), 3, _NOPERM);
98
    }
99
    if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin()) {
100
        //disable cache
101
        $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
102
    }
103
    $GLOBALS['xoopsTpl']->assign('user_ownpage', false);
104
}
105
$GLOBALS['xoopsTpl']->assign('user_uid', $thisUser->getVar('uid'));
106
if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin()) {
107
    $GLOBALS['xoopsTpl']->assign('lang_editprofile', _US_EDITPROFILE);
108
    $GLOBALS['xoopsTpl']->assign('lang_deleteaccount', _US_DELACCOUNT);
109
    $GLOBALS['xoopsTpl']->assign('userlevel', $thisUser->isActive());
110
}
111
// Dynamic User Profiles
112
$thisUsergroups    = $thisUser->getGroups();
113
$visibilityHandler = $helper->getHandler('Visibility');
114
//search for visible Fields or null for none
115
$field_ids_visible = $visibilityHandler->getVisibleFields($thisUsergroups, $groups);
116
$profileHandler    = $helper->getHandler('Profile');
117
$fields            = $profileHandler->loadFields();
118
$categoryHandler   = $helper->getHandler('Category');
119
$categoryCriteria  = new CriteriaCompo();
120
$categoryCriteria->setSort('cat_weight');
121
$cats = $categoryHandler->getObjects($categoryCriteria, true, false);
122
unset($categoryCriteria);
123
$avatar = '';
124
if ($thisUser->getVar('user_avatar') && 'blank.gif' !== $thisUser->getVar('user_avatar')) {
125
    $avatar = XOOPS_UPLOAD_URL . '/' . $thisUser->getVar('user_avatar');
126
}
127
foreach (array_keys($cats) as $i) {
128
    $categories[$i] = $cats[$i];
129
}
130
$profileHandler = $helper->getHandler('Profile');
131
$profile        = $profileHandler->get($thisUser->getVar('uid'));
132
// Add dynamic fields
133
foreach (array_keys($fields) as $i) {
134
    //If field is not visible, skip
135
    //if ( $field_ids_visible && !in_array($fields[$i]->getVar('field_id'), $field_ids_visible) ) continue;
136
    if (!in_array($fields[$i]->getVar('field_id'), $field_ids_visible)) {
137
        continue;
138
    }
139
    $cat_id = $fields[$i]->getVar('cat_id');
140
    $value  = $fields[$i]->getOutputValue($thisUser, $profile);
141
    if (is_array($value)) {
142
        $value = implode('<br>', array_values($value));
143
    }
144
    if ($value) {
145
        $categories[$cat_id]['fields'][] = ['title' => $fields[$i]->getVar('field_title'), 'value' => $value];
146
        $weights[$cat_id][]              = $fields[$i]->getVar('cat_id');
147
    }
148
}
149
$GLOBALS['xoopsTpl']->assign('categories', $categories);
150
// Dynamic user profiles end
151
$featuredvideocode  = '';
152
$featuredvideotitle = '';
153
$featuredvideodesc  = '';
154
//require_once __DIR__ . '/class/suico_controller.php';
155
//if (!@ require_once XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/user.php') {
156
//    require_once XOOPS_ROOT_PATH . '/language/english/user.php';
157
//}
158
/**
159
 * This variable define the beginning of the navigation must be
160
 * set here so all calls to database will take this into account
161
 */
162
$start = Request::getInt('start', 0, 'GET');
163
/**
164
 * Criteria for featuredvideo
165
 */
166
$criteriaUidVideo       = new Criteria('uid_owner', $controller->uidOwner);
167
$criteria_featuredvideo = new Criteria('featured_video', '1');
168
$criteria_video         = new CriteriaCompo($criteria_featuredvideo);
169
$criteria_video->add($criteriaUidVideo);
170
if ((isset($nbSections['countVideos']) && $nbSections['countVideos'] > 0) && ($videos = $controller->videosFactory->getObjects($criteria_video))) {
171
    $featuredvideocode  = $videos[0]->getVar('youtube_code');
172
    $featuredvideotitle = $videos[0]->getVar('video_title');
173
    $featuredvideodesc  = $videos[0]->getVar('video_desc');
174
}
175
/**
176
 * Groups
177
 */
178
$criteria_groups = new Criteria('rel_user_uid', $controller->uidOwner);
179
$groups          = $controller->relgroupusersFactory->getGroups(8, $criteria_groups);
180
/**
181
 * Visitors
182
 */
183
$controller->visitorsFactory->purgeVisits();
184
if (0 === $controller->isAnonym) {
185
    // Fetching last visitors
186
    if ($controller->uidOwner !== $xoopsUser->getVar('uid')) {
187
        $criteriaDeleteOldVisits = new CriteriaCompo(new Criteria('uid_owner', $controller->uidOwner));
188
        $criteriaDeleteOldVisits->add(new Criteria('uid_visitor', $xoopsUser->getVar('uid')));
189
        $visitorsFactory->deleteAll($criteriaDeleteOldVisits, true);
190
191
192
193
        $visitor_now = $controller->visitorsFactory->create();
194
        $visitor_now->setVar('uid_owner', $controller->uidOwner);
195
        $visitor_now->setVar('uid_visitor', $xoopsUser->getVar('uid'));
196
        $visitor_now->setVar('uname_visitor', $xoopsUser->getVar('uname'));
197
        $controller->visitorsFactory->insert2($visitor_now);
198
    }
199
    $criteria_visitors = new Criteria('uid_owner', $controller->uidOwner);
200
    //$criteria_visitors->setLimit(5);
201
    $visitorsObjectArray = $controller->visitorsFactory->getObjects(
202
        $criteria_visitors
203
    );
204
    // Lets populate an array with the data from visitors
205
    $i             = 0;
206
    $visitorsArray = [];
207
    if (is_array($visitorsObjectArray) && count($visitorsObjectArray) > 0) {
208
        foreach ($visitorsObjectArray as $visitor) {
209
            $myvisitor = [];
210
            if (null !== $visitor) {
211
                $myvisitor['uid_visitor']    = $visitor->getVar('uid_visitor', 's');
212
                $myvisitor['uname_visitor']  = $visitor->getVar('uname_visitor', 's');
213
                $myvisitor['date_visited']   = formatTimestamp($visitor->getVar('date_visited'), 'S');
214
                $memberHandler               = xoops_getHandler('member');
215
                $visitor                     = $memberHandler->getUser($visitor->getVar('uid_visitor'));
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

215
                /** @scrutinizer ignore-call */ 
216
                $visitor                     = $memberHandler->getUser($visitor->getVar('uid_visitor'));
Loading history...
216
                $myvisitor['avatar_visitor'] = $visitor->getVar('user_avatar', 's');
217
                $visitorsArray[]             = $myvisitor;
218
                unset($myvisitor);
219
                ++$i;
220
            }
221
        }
222
    }
223
    $xoopsTpl->assign('visitors', $visitorsArray);
224
    $xoopsTpl->assign('lang_visitors', _MD_SUICO_VISITORS);
225
//    $criteria_deletevisitors = new criteria('uid_owner', $uid);
226
//    $criteria_deletevisitors->setStart(5);
227
    //        print_r($criteria_deletevisitors);
228
    //        $visitorsFactory->deleteAll($criteria_deletevisitors, true);
229
}
230
$avatar        = $controller->owner->getVar('user_avatar');
231
$memberHandler = xoops_getHandler('member');
232
$thisUser      = $memberHandler->getUser($controller->uidOwner);
233
$myts          = \MyTextSanitizer::getInstance();
234
//navbar
235
$xoopsTpl->assign('lang_mysection', _MD_SUICO_MYPROFILE);
236
$xoopsTpl->assign('section_name', _MD_SUICO_PROFILE);
237
//$xoopsTpl->assign('path_suico_uploads',$helper->getConfig('link_path_upload'));
238
//groups
239
$xoopsTpl->assign('groups', $groups);
240
if (isset($nbSections['countGroups']) && $nbSections['countGroups'] <= 0) {
241
    $xoopsTpl->assign('lang_nogroupsyet', _MD_SUICO_NOGROUPSYET);
242
}
243
$xoopsTpl->assign('lang_viewallgroups', _MD_SUICO_ALLGROUPS);
244
//Avatar and Main
245
$xoopsTpl->assign('avatar_url', $avatar);
246
$xoopsTpl->assign('lang_selectavatar', _MD_SUICO_SELECTAVATAR);
247
$xoopsTpl->assign('lang_selectfeaturedvideo', _MD_SUICO_SELECTFEATUREDVIDEO);
248
$xoopsTpl->assign('lang_noavatar', _MD_SUICO_NOAVATARYET);
249
$xoopsTpl->assign('lang_nofeaturedvideo', _MD_SUICO_NOFEATUREDVIDEOYET);
250
$xoopsTpl->assign('lang_featuredvideo', _MD_SUICO_VIDEO_FEATURED);
251
$xoopsTpl->assign('lang_viewallvideos', _MD_SUICO_ALLVIDEOS);
252
if (isset($nbSections['countVideos']) && $nbSections['countVideos'] > 0) {
253
    $xoopsTpl->assign('featuredvideocode', $featuredvideocode);
254
    $xoopsTpl->assign('featuredvideodesc', $featuredvideodesc);
255
    $xoopsTpl->assign('featuredvideotitle', $featuredvideotitle);
256
    $xoopsTpl->assign(
257
        'width',
258
        $helper->getConfig('width_maintube')
259
    ); // We still need to configure the main size in the configs and change the template
260
    $xoopsTpl->assign(
261
        'height',
262
        $helper->getConfig('height_maintube')
263
    );
264
}
265
/**
266
 * Friends
267
 */
268
$friendController = new FriendsController($xoopsDB, $xoopsUser);
269
if ($xoopsUser) {
270
    $friendrequest = 0;
271
    if (1 === $friendController->isOwner) {
272
        $criteria_uidfriendrequest = new Criteria('friendrequestto_uid', $friendController->uidOwner);
273
        $newFriendrequest          = $friendController->friendrequestFactory->getObjects($criteria_uidfriendrequest);
274
        if ($newFriendrequest) {
275
            $countFriendrequest     = count($newFriendrequest);
276
            $memberHandler          = xoops_getHandler('member');
277
            $friendrequester        = $memberHandler->getUser($newFriendrequest[0]->getVar('friendrequester_uid'));
278
            $friendrequester_uid    = $friendrequester->getVar('uid');
279
            $friendrequester_uname  = $friendrequester->getVar('uname');
280
            $friendrequester_avatar = $friendrequester->getVar('user_avatar');
281
            $friendrequest_id       = $newFriendrequest[0]->getVar('friendreq_id');
282
            $friendrequest          = 1;
283
        }
284
    }
285
    //requests to become friend
286
    if (1 === $friendrequest) {
287
        $xoopsTpl->assign('lang_you_have_x_friendrequests', sprintf(_MD_SUICO_YOU_HAVE_X_FRIENDREQUESTS, $countFriendrequest));
288
        $xoopsTpl->assign('friendrequester_uid', $friendrequester_uid);
289
        $xoopsTpl->assign('friendrequester_uname', $friendrequester_uname);
290
        $xoopsTpl->assign('friendrequester_avatar', $friendrequester_avatar);
291
        $xoopsTpl->assign('friendrequest', $friendrequest);
292
        $xoopsTpl->assign('friendrequest_id', $friendrequest_id);
293
        $xoopsTpl->assign('lang_rejected', _MD_SUICO_UNKNOWN_REJECTING);
294
        $xoopsTpl->assign('lang_accepted', _MD_SUICO_UNKNOWN_ACCEPTING);
295
        $xoopsTpl->assign('lang_acquaintance', _MD_SUICO_AQUAITANCE);
296
        $xoopsTpl->assign('lang_friend', _MD_SUICO_FRIEND);
297
        $xoopsTpl->assign('lang_bestfriend', _MD_SUICO_BESTFRIEND);
298
        $linkedpetioner = '<a href="index.php?uid=' . $friendrequester_uid . '">' . $friendrequester_uname . '</a>';
299
        $xoopsTpl->assign('lang_askingfriend', sprintf(_MD_SUICO_ASKINGFRIEND, $linkedpetioner));
300
    }
301
}
302
$xoopsTpl->assign('lang_askusertobefriend', _MD_SUICO_ASKBEFRIEND);
303
$xoopsTpl->assign('lang_addfriend', _MD_SUICO_ADDFRIEND);
304
$xoopsTpl->assign('lang_friendrequestpending', _MD_SUICO_FRIENDREQUEST_PENDING);
305
$xoopsTpl->assign('lang_myfriend', _MD_SUICO_MYFRIEND);
306
$xoopsTpl->assign('lang_friendrequestsent', _MD_SUICO_FRIENDREQUEST_SENT);
307
$xoopsTpl->assign('lang_acceptfriend', _MD_SUICO_FRIEND_ACCEPT);
308
$xoopsTpl->assign('lang_rejectfriend', _MD_SUICO_FRIEND_REJECT);
309
$criteria_friends = new Criteria('friend1_uid', $friendController->uidOwner);
310
$friends          = $friendController->friendshipsFactory->getFriends(8, $criteria_friends);
311
$xoopsTpl->assign('friends', $friends);
312
$xoopsTpl->assign('lang_friendstitle', sprintf(_MD_SUICO_FRIENDSTITLE, $friendController->nameOwner));
0 ignored issues
show
It seems like $friendController->nameOwner can also be of type array and array; however, parameter $args of sprintf() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

312
$xoopsTpl->assign('lang_friendstitle', sprintf(_MD_SUICO_FRIENDSTITLE, /** @scrutinizer ignore-type */ $friendController->nameOwner));
Loading history...
313
$xoopsTpl->assign('lang_viewallfriends', _MD_SUICO_ALLFRIENDS);
314
$xoopsTpl->assign('lang_nofriendsyet', _MD_SUICO_NOFRIENDSYET);
315
//search
316
$xoopsTpl->assign('lang_usercontributions', _MD_SUICO_USER_CONTRIBUTIONS);
317
//Profile
318
$xoopsTpl->assign('lang_detailsinfo', _MD_SUICO_USER_DETAILS);
319
$xoopsTpl->assign('lang_contactinfo', _MD_SUICO_CONTACTINFO);
320
//$xoopsTpl->assign('path_suico_uploads',$helper->getConfig('link_path_upload'));
321
$xoopsTpl->assign(
322
    'lang_max_countPicture',
323
    sprintf(_MD_SUICO_YOUCANHAVE, $helper->getConfig('countPicture'))
324
);
325
$xoopsTpl->assign('lang_delete', _MD_SUICO_DELETE);
326
$xoopsTpl->assign('lang_visitors', _MD_SUICO_VISITORS);
327
$xoopsTpl->assign('lang_profilevisitors', _MD_SUICO_PROFILEVISITORS);
328
$xoopsTpl->assign('lang_editprofile', _MD_SUICO_EDITPROFILE);
329
$xoopsTpl->assign('user_uname', $thisUser->getVar('uname'));
330
$xoopsTpl->assign('user_realname', $thisUser->getVar('name'));
331
$xoopsTpl->assign('lang_uname', _US_NICKNAME);
332
$xoopsTpl->assign('lang_website', _US_WEBSITE);
333
$userwebsite = '' !== $thisUser->getVar('url', 'E') ? '<a href="' . $thisUser->getVar(
334
        'url',
335
        'E'
336
    ) . '" target="_blank">' . $thisUser->getVar(
337
        'url'
338
    ) . '</a>' : '';
339
$xoopsTpl->assign('user_websiteurl', $userwebsite);
340
$xoopsTpl->assign('lang_email', _US_EMAIL);
341
$xoopsTpl->assign('lang_privmsg', _US_PM);
342
$xoopsTpl->assign('lang_location', _US_LOCATION);
343
$xoopsTpl->assign('user_location', $thisUser->getVar('user_from'));
344
$xoopsTpl->assign('lang_occupation', _US_OCCUPATION);
345
$xoopsTpl->assign('user_occupation', $thisUser->getVar('user_occ'));
346
$xoopsTpl->assign('lang_interest', _US_INTEREST);
347
$xoopsTpl->assign('user_interest', $thisUser->getVar('user_intrest'));
348
$xoopsTpl->assign('lang_extrainfo', _US_EXTRAINFO);
349
$var = $thisUser->getVar('bio', 'N');
350
$xoopsTpl->assign('user_extrainfo', $myts->displayTarea($var, 0, 1, 1));
351
$xoopsTpl->assign('lang_statistics', _US_STATISTICS);
352
$xoopsTpl->assign('lang_membersince', _US_MEMBERSINCE);
353
$var = $thisUser->getVar('user_regdate');
354
$xoopsTpl->assign('user_joindate', formatTimestamp($var, 's'));
355
$xoopsTpl->assign('lang_rank', _US_RANK);
356
$xoopsTpl->assign('lang_posts', _US_POSTS);
357
$xoopsTpl->assign('lang_basicInfo', _US_BASICINFO);
358
$xoopsTpl->assign('lang_more', _US_MOREABOUT);
359
$xoopsTpl->assign('lang_myinfo', _US_MYINFO);
360
$xoopsTpl->assign('user_posts', $thisUser->getVar('posts'));
361
$xoopsTpl->assign('lang_lastlogin', _US_LASTLOGIN);
362
$date = $thisUser->getVar('last_login');
363
if (!empty($date)) {
364
    $xoopsTpl->assign('user_lastlogin', formatTimestamp($date, 'm'));
365
}
366
$xoopsTpl->assign('lang_notregistered', _US_NOTREGISTERED);
367
$xoopsTpl->assign('lang_signature', _US_SIGNATURE);
368
$var = $thisUser->getVar('user_sig', 'N');
369
$xoopsTpl->assign('user_signature', $myts->displayTarea($var, 0, 1, 1));
370
$xoopsTpl->assign('user_viewemail', $thisUser->getVar('user_viewemail', 'E'));
371
if (1 === $thisUser->getVar('user_viewemail')) {
372
    $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
373
} else {
374
    $xoopsTpl->assign('user_email', '&nbsp;');
375
}
376
$xoopsTpl->assign('user_onlinestatus', $thisUser->isOnline());
377
$xoopsTpl->assign('lang_onlinestatus', _MD_SUICO_ONLINESTATUS);
378
$xoopsTpl->assign('uname', $thisUser->getVar('uname'));
379
$xoopsTpl->assign('lang_realname', _US_REALNAME);
380
$xoopsTpl->assign('name', $thisUser->getVar('name'));
381
$gpermHandler  = xoops_getHandler('groupperm');
382
$groups        = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
383
$moduleHandler = xoops_getHandler('module');
384
$criteria      = new CriteriaCompo(new Criteria('hassearch', 1));
385
$criteria->add(new Criteria('isactive', 1));
386
$mids = array_keys($moduleHandler->getList($criteria));
0 ignored issues
show
The method getList() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsModuleHandler or XoopsImageHandler or XoopsRankHandler or XoopsCommentHandler or XoopsTplsetHandler or XoopsAvatarHandler or XoopsBlockHandler or XoopsImagesetHandler or XoopsPersistableObjectHandler or XoopsImagecategoryHandler. ( Ignorable by Annotation )

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

386
$mids = array_keys($moduleHandler->/** @scrutinizer ignore-call */ getList($criteria));
Loading history...
387
//user rank
388
$userrank = $thisUser->rank();
389
if ($userrank['image']) {
390
    $xoopsTpl->assign('user_rankimage', '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="">');
391
}
392
$xoopsTpl->assign('user_ranktitle', $userrank['title']);
393
foreach ($mids as $mid) {
394
    if ($gpermHandler->checkRight('module_read', $mid, $groups)) {
0 ignored issues
show
The method checkRight() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsGroupPermHandler 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
    if ($gpermHandler->/** @scrutinizer ignore-call */ checkRight('module_read', $mid, $groups)) {
Loading history...
395
        $module   = $moduleHandler->get($mid);
396
        $user_uid = $thisUser->getVar('uid');
397
        $results  = $module->search('', '', 5, 0, $user_uid);
0 ignored issues
show
The method search() does not exist on XoopsObject. It seems like you code against a sub-type of XoopsObject such as XoopsModule. ( 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
        $results  = $module->search('', '', 5, 0, $user_uid);
Loading history...
398
        if (is_array($results)) {
399
            $count = count($results);
400
        }
401
        if (is_array($results) && $count > 0) {
402
            for ($i = 0; $i < $count; ++$i) {
403
                if (isset($results[$i]['image']) && '' !== $results[$i]['image']) {
404
                    $results[$i]['image'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['image'];
405
                } else {
406
                    $results[$i]['image'] = 'images/icons/posticon2.gif';
407
                }
408
                if (!preg_match('#^http[s]*:\/\/#i', $results[$i]['link'])) {
409
                    $results[$i]['link'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['link'];
410
                }
411
                $results[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']);
412
                $results[$i]['time']  = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
413
            }
414
            if (5 === $count) {
415
                $showall_link = '<a href="../../search.php?action=showallbyuser&amp;mid=' . $mid . '&amp;uid=' . $thisUser->getVar(
416
                        'uid'
417
                    ) . '">' . _US_SHOWALL . '</a>';
418
            } else {
419
                $showall_link = '';
420
            }
421
            $xoopsTpl->append(
422
                'modules',
423
                [
424
                    'name'         => $module->getVar('name'),
425
                    'results'      => $results,
426
                    'showall_link' => $showall_link,
427
                ]
428
            );
429
        }
430
        unset($module);
431
    }
432
}
433
require __DIR__ . '/footer.php';
434
require dirname(__DIR__, 2) . '/footer.php';
435