Passed
Push — master ( 4ef713...b149e1 )
by
unknown
05:52 queued 02:52
created

index.php (9 issues)

1
<?php declare(strict_types=1);
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
*/
12
13
/**
14
 * @copyright    XOOPS Project https://xoops.org/
15
 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
16
 * @author       Marcello Brandão aka  Suico
17
 * @author       XOOPS Development Team
18
 * @since
19
 */
20
21
use Xmf\Request;
22
use XoopsModules\Yogurt;
23
use XoopsModules\Yogurt\IndexController;
24
25
/**
26
 * Xoops header
27
 */
28
$GLOBALS['xoopsOption']['template_main'] = 'yogurt_index.tpl';
29
require __DIR__ . '/header.php';
30
31
$helper->loadLanguage('user');
32
33
$controller = new IndexController($xoopsDB, $xoopsUser);
34
/**
35
 * Fetching numbers of groups friends videos pictures etc...
36
 */
37
$nbSections = $controller->getNumbersSections();
38
39
$uid=$controller->uidOwner;
40
41
/* @var  XoopsGroupPermHandler $gperm_handler */
42
$gperm_handler = xoops_getHandler('groupperm');
43
$groups        = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
44
45
if (is_object($GLOBALS['xoopsUser']) && $uid == $GLOBALS['xoopsUser']->getVar('uid')) {
46
    //disable cache
47
    $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
48
    include $GLOBALS['xoops']->path('header.php');
49
50
    /* @var XoopsConfigHandler $config_handler */
51
    $config_handler             = xoops_getHandler('config');
52
    $GLOBALS['xoopsConfigUser'] = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
53
54
    $GLOBALS['xoopsTpl']->assign('user_ownpage', true);
55
    if ($GLOBALS['xoopsConfigUser']['self_delete'] == 1) {
56
        $GLOBALS['xoopsTpl']->assign('user_candelete', true);
57
        $GLOBALS['xoopsTpl']->assign('lang_deleteaccount', _US_DELACCOUNT);
58
    } else {
59
        $GLOBALS['xoopsTpl']->assign('user_candelete', false);
60
    }
61
	$GLOBALS['xoopsTpl']->assign('user_changeemail', $GLOBALS['xoopsConfigUser']['allow_chgmail']);
62
    $thisUser =& $GLOBALS['xoopsUser'];
63
} else {
64
    /* @var XoopsMemberHandler $member_handler */
65
    $member_handler = xoops_getHandler('member');
66
    $thisUser       = $member_handler->getUser($uid);
67
68
    // Redirect if not a user or not active and the current user is not admin
69
   if (!is_object($thisUser) || (!$thisUser->isActive() && (!$GLOBALS['xoopsUser'] || !$GLOBALS['xoopsUser']->isAdmin()))) {
70
		redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n'), 3, _US_SELECTNG);
71
    }
72
73
    /**
74
     * Access permission check
75
     *
76
     * Note:
77
     * "thisUser" refers to the user whose profile will be accessed; "xoopsUser" refers to the current user $GLOBALS['xoopsUser']
78
     * "Basic Groups" refer to XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS and XOOPS_GROUP_ANONYMOUS;
79
     * "Non Basic Groups" refer to all other custom groups
80
     *
81
     * 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
82
     * 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
83
     * 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
84
     *
85
     */
86
    // Redirect if current user is not allowed to access the user's profile based on group permission
87
    $groups_basic             = array(XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS, XOOPS_GROUP_ANONYMOUS);
88
    $groups_thisUser          = $thisUser->getGroups();
89
    $groups_thisUser_nonbasic = array_diff($groups_thisUser, $groups_basic);
90
    $groups_xoopsUser         = $groups;
91
    /* @var  XoopsGroupPermHandler $gperm_handler */
92
    $gperm_handler            = xoops_getHandler('groupperm');
93
    $groups_accessible        = $gperm_handler->getItemIds('profile_access', $groups_xoopsUser, $GLOBALS['xoopsModule']->getVar('mid'));
94
95
    $rejected = false;
96
    if ($thisUser->isAdmin()) {
97
        $rejected = !in_array(XOOPS_GROUP_ADMIN, $groups_accessible);
98
    } 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...
99
        $rejected = !array_intersect($groups_thisUser_nonbasic, $groups_accessible);
100
    } else {
101
        $rejected = !in_array(XOOPS_GROUP_USERS, $groups_accessible);
102
    }
103
104
    if ($rejected) {
105
       // redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n'), 3, _NOPERM);
106
    }
107
108
    if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin()) {
109
        //disable cache
110
        $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
111
    }
112
    $GLOBALS['xoopsTpl']->assign('user_ownpage', false);
113
}
114
115
$GLOBALS['xoopsTpl']->assign('user_uid', $thisUser->getVar('uid'));
116
if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin()) {
117
    $GLOBALS['xoopsTpl']->assign('lang_editprofile', _US_EDITPROFILE);
118
    $GLOBALS['xoopsTpl']->assign('lang_deleteaccount', _US_DELACCOUNT);
119
    $GLOBALS['xoopsTpl']->assign('userlevel', $thisUser->isActive());
120
}
121
122
123
124
// Dynamic User Profiles
125
$thisUsergroups     = $thisUser->getGroups();
126
$visibility_handler = xoops_getModuleHandler('visibility');
127
//search for visible Fields or null for none
128
$field_ids_visible = $visibility_handler->getVisibleFields($thisUsergroups, $groups);
0 ignored issues
show
The method getVisibleFields() 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

128
$field_ids_visible = $visibility_handler->/** @scrutinizer ignore-call */ getVisibleFields($thisUsergroups, $groups);
Loading history...
129
130
$profile_handler = xoops_getModuleHandler('profile');
131
$fields          = $profile_handler->loadFields();
0 ignored issues
show
The method loadFields() 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

131
$fields          = $profile_handler->/** @scrutinizer ignore-call */ loadFields();
Loading history...
132
$cat_handler     = xoops_getModuleHandler('category');
133
$cat_crit        = new CriteriaCompo();
134
$cat_crit->setSort('cat_weight');
135
$cats = $cat_handler->getObjects($cat_crit, true, false);
0 ignored issues
show
The method getObjects() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of said class. However, the method does not exist in XoopsRankHandler or XoUserHandler. Are you sure you never get one of those? ( Ignorable by Annotation )

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

135
$cats = $cat_handler->/** @scrutinizer ignore-call */ getObjects($cat_crit, true, false);
Loading history...
136
unset($cat_crit);
137
138
$avatar = '';
139
if ($thisUser->getVar('user_avatar') && 'blank.gif' !== $thisUser->getVar('user_avatar')) {
140
    $avatar = XOOPS_UPLOAD_URL . '/' . $thisUser->getVar('user_avatar');
141
}
142
143
foreach (array_keys($cats) as $i) {
144
    $categories[$i] = $cats[$i];
145
}
146
147
$profile_handler = xoops_getModuleHandler('profile');
148
$profile         = $profile_handler->get($thisUser->getVar('uid'));
149
// Add dynamic fields
150
foreach (array_keys($fields) as $i) {
151
    //If field is not visible, skip
152
    //if ( $field_ids_visible && !in_array($fields[$i]->getVar('field_id'), $field_ids_visible) ) continue;
153
    if (!in_array($fields[$i]->getVar('field_id'), $field_ids_visible)) {
154
        continue;
155
    }
156
    $cat_id = $fields[$i]->getVar('cat_id');
157
    $value  = $fields[$i]->getOutputValue($thisUser, $profile);
158
    if (is_array($value)) {
159
        $value = implode('<br>', array_values($value));
160
    }
161
    if ($value) {
162
        $categories[$cat_id]['fields'][] = array('title' => $fields[$i]->getVar('field_title'), 'value' => $value);
163
        $weights[$cat_id][]              = $fields[$i]->getVar('cat_id');
164
    }
165
}
166
167
$GLOBALS['xoopsTpl']->assign('categories', $categories);
168
// Dynamic user profiles end
169
170
$mainvideocode = '';
171
$mainvideodesc = '';
172
173
//require_once __DIR__ . '/class/yogurt_controller.php';
174
//if (!@ require_once XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/user.php') {
175
//    require_once XOOPS_ROOT_PATH . '/language/english/user.php';
176
//}
177
178
179
180
/**
181
 * This variable define the beginning of the navigation must be
182
 * set here so all calls to database will take this into account
183
 */
184
$start = Request::getInt(
185
    'start',
186
    0,
187
    'GET'
188
);
189
190
/**
191
 * Criteria for mainvideo
192
 */
193
$criteria_uidvideo  = new Criteria('uid_owner', $controller->uidOwner);
194
$criteria_mainvideo = new Criteria('main_video', '1');
195
$criteria_video     = new CriteriaCompo($criteria_mainvideo);
196
$criteria_video->add($criteria_uidvideo);
197
198
if ((isset($nbSections['nbVideos']) && $nbSections['nbVideos'] > 0) && ($videos = $controller->videosFactory->getObjects($criteria_video))) {
199
    $mainvideocode = $videos[0]->getVar('youtube_code');
200
    $mainvideodesc = $videos[0]->getVar('video_desc');
201
}
202
203
204
/**
205
 * Groups
206
 */
207
$criteria_groups = new Criteria('rel_user_uid', $controller->uidOwner);
208
$groups          = $controller->relgroupusersFactory->getGroups(8, $criteria_groups);
209
210
/**
211
 * Visitors
212
 */
213
 $controller->visitorsFactory->purgeVisits();
214
 
215
if (0 === $controller->isAnonym) {
216
    /**
217
     * Fectching last visitors
218
     */
219
    if ($controller->uidOwner !== $xoopsUser->getVar('uid')) {
220
        $visitor_now = $controller->visitorsFactory->create();
221
        $visitor_now->setVar('uid_owner', $controller->uidOwner);
222
        $visitor_now->setVar('uid_visitor', $xoopsUser->getVar('uid'));
223
        $visitor_now->setVar('uname_visitor', $xoopsUser->getVar('uname'));
224
        $controller->visitorsFactory->insert2($visitor_now);
225
    }
226
    $criteria_visitors = new Criteria('uid_owner', $controller->uidOwner);
227
    //$criteria_visitors->setLimit(5);
228
    $visitors_object_array = $controller->visitorsFactory->getObjects(
229
        $criteria_visitors
230
    );
231
232
    /**
233
     * Lets populate an array with the dati from visitors
234
     */
235
    $i              = 0;
236
    $visitors_array = [];
237
    foreach ($visitors_object_array as $visitor) {
238
        $indice                  = $visitor->getVar('uid_visitor', 's');
239
        $visitors_array[$indice] = $visitor->getVar('uname_visitor', 's');
240
241
        $i++;
242
    }
243
244
    $xoopsTpl->assign('visitors', $visitors_array);
245
    $xoopsTpl->assign('lang_visitors', _MD_YOGURT_VISITORS);
246
    /*    $criteria_deletevisitors = new criteria('uid_owner',$uid);
247
        $criteria_deletevisitors->setStart(5);
248
249
        print_r($criteria_deletevisitors);
250
        $visitorsFactory->deleteAll($criteria_deletevisitors, true);
251
    */
252
}
253
254
$avatar = $controller->owner->getVar('user_avatar');
255
256
$memberHandler = xoops_getHandler('member');
257
$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

257
$thisUser      = $memberHandler->/** @scrutinizer ignore-call */ getUser($controller->uidOwner);
Loading history...
258
$myts          = MyTextSanitizer::getInstance();
259
260
//navbar
261
$xoopsTpl->assign('lang_mysection', _MD_YOGURT_MYPROFILE);
262
$xoopsTpl->assign('section_name', _MD_YOGURT_PROFILE);
263
264
//$xoopsTpl->assign('path_yogurt_uploads',$helper->getConfig('link_path_upload'));
265
266
//groups
267
$xoopsTpl->assign('groups', $groups);
268
if (isset($nbSections['nbGroups']) && $nbSections['nbGroups'] <= 0) {
269
    $xoopsTpl->assign('lang_nogroupsyet', _MD_YOGURT_NOGROUPSYET);
270
}
271
$xoopsTpl->assign('lang_viewallgroups', _MD_YOGURT_ALLGROUPS);
272
273
//Avatar and Main
274
$xoopsTpl->assign('avatar_url', $avatar);
275
$xoopsTpl->assign('lang_selectavatar', _MD_YOGURT_SELECTAVATAR);
276
$xoopsTpl->assign('lang_selectmainvideo', _MD_YOGURT_SELECTMAINVIDEO);
277
$xoopsTpl->assign('lang_noavatar', _MD_YOGURT_NOAVATARYET);
278
$xoopsTpl->assign('lang_nomainvideo', _MD_YOGURT_NOMAINVIDEOYET);
279
$xoopsTpl->assign('lang_featuredvideo', _MD_YOGURT_VIDEO_FEATURED);
280
$xoopsTpl->assign('lang_viewallvideos', _MD_YOGURT_ALLVIDEOS);
281
282
if (isset($nbSections['nbVideos']) && $nbSections['nbVideos'] > 0) {
283
    $xoopsTpl->assign('mainvideocode', $mainvideocode);
284
    $xoopsTpl->assign('mainvideodesc', $mainvideodesc);
285
    $xoopsTpl->assign(
286
        'width',
287
        $helper->getConfig('width_maintube')
288
    ); // Falta configurar o tamnho do main nas configs e alterar no template
289
    $xoopsTpl->assign(
290
        'height',
291
        $helper->getConfig('height_maintube')
292
    );
293
}
294
295
/**
296
 * Friends
297
 */
298
if ($xoopsUser){
299
300
$controller = new Yogurt\FriendsController($xoopsDB, $xoopsUser);
301
302
$friendrequest = 0;
303
if (1 === $controller->isOwner) {
304
    $criteria_uidfriendrequest = new Criteria('friendrequestto_uid', $controller->uidOwner);
305
    $newFriendrequest          = $controller->friendrequestFactory->getObjects($criteria_uidfriendrequest);
306
    if ($newFriendrequest) {
307
        $nb_friendrequest      = count($newFriendrequest);
308
        $friendrequesterHandler = xoops_getHandler('member');
309
        $friendrequester        = $friendrequesterHandler->getUser($newFriendrequest[0]->getVar('friendrequester_uid'));
310
        $friendrequester_uid    = $friendrequester->getVar('uid');
311
        $friendrequester_uname  = $friendrequester->getVar('uname');
312
        $friendrequester_avatar = $friendrequester->getVar('user_avatar');
313
        $friendrequest_id       = $newFriendrequest[0]->getVar('friendpet_id');
314
        $friendrequest          = 1;
315
    }
316
}
317
 
318
//requests to become friend
319
if (1 === $friendrequest) {
320
	$xoopsTpl->assign('lang_youhavexfriendrequests', sprintf(_MD_YOGURT_YOUHAVEXFRIENDREQUESTS, $nb_friendrequest));
321
    $xoopsTpl->assign('friendrequester_uid', $friendrequester_uid);
322
    $xoopsTpl->assign('friendrequester_uname', $friendrequester_uname);
323
    $xoopsTpl->assign('friendrequester_avatar', $friendrequester_avatar);
324
    $xoopsTpl->assign('friendrequest', $friendrequest);
325
    $xoopsTpl->assign('friendrequest_id', $friendrequest_id);
326
    $xoopsTpl->assign('lang_rejected', _MD_YOGURT_UNKNOWN_REJECTING);
327
    $xoopsTpl->assign('lang_accepted', _MD_YOGURT_UNKNOWN_ACCEPTING);
328
    $xoopsTpl->assign('lang_acquaintance', _MD_YOGURT_AQUAITANCE);
329
    $xoopsTpl->assign('lang_friend', _MD_YOGURT_FRIEND);
330
    $xoopsTpl->assign('lang_bestfriend', _MD_YOGURT_BESTFRIEND);
331
    $linkedpetioner = '<a href="index.php?uid=' . $friendrequester_uid . '">' . $friendrequester_uname . '</a>';
332
    $xoopsTpl->assign('lang_askingfriend', sprintf(_MD_YOGURT_ASKINGFRIEND, $linkedpetioner));
333
}
334
}
335
336
$xoopsTpl->assign('lang_askusertobefriend', _MD_YOGURT_ASKBEFRIEND);
337
$xoopsTpl->assign('lang_addfriend', _MD_YOGURT_ADDFRIEND);
338
$xoopsTpl->assign('lang_friendrequestpending', _MD_YOGURT_FRIENDREQUEST_PENDING);
339
$xoopsTpl->assign('lang_myfriend', _MD_YOGURT_MYFRIEND);
340
$xoopsTpl->assign('lang_friendrequestsent', _MD_YOGURT_FRIENDREQUEST_SENT);
341
$xoopsTpl->assign('lang_acceptfriend', _MD_YOGURT_FRIEND_ACCEPT);
342
$xoopsTpl->assign('lang_rejectfriend', _MD_YOGURT_FRIEND_REJECT);
343
344
$criteria_friends = new Criteria('friend1_uid', $controller->uidOwner);
345
$friends          = $controller->friendshipsFactory->getFriends(8, $criteria_friends);
346
$xoopsTpl->assign('friends', $friends);
347
$xoopsTpl->assign('lang_friendstitle', sprintf(_MD_YOGURT_FRIENDSTITLE, $controller->nameOwner));
0 ignored issues
show
It seems like $controller->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

347
$xoopsTpl->assign('lang_friendstitle', sprintf(_MD_YOGURT_FRIENDSTITLE, /** @scrutinizer ignore-type */ $controller->nameOwner));
Loading history...
348
$xoopsTpl->assign('lang_viewallfriends', _MD_YOGURT_ALLFRIENDS);
349
$xoopsTpl->assign('lang_nofriendsyet', _MD_YOGURT_NOFRIENDSYET);
350
351
352
//search
353
$xoopsTpl->assign('lang_usercontributions', _MD_YOGURT_USER_CONTRIBUTIONS);
354
355
//Profile
356
$xoopsTpl->assign('lang_detailsinfo', _MD_YOGURT_USER_DETAILS);
357
$xoopsTpl->assign('lang_contactinfo', _MD_YOGURT_CONTACTINFO);
358
//$xoopsTpl->assign('path_yogurt_uploads',$helper->getConfig('link_path_upload'));
359
$xoopsTpl->assign(
360
    'lang_max_nb_pict',
361
    sprintf(_MD_YOGURT_YOUCANHAVE, $helper->getConfig('nb_pict'))
362
);
363
$xoopsTpl->assign('lang_delete', _MD_YOGURT_DELETE);
364
$xoopsTpl->assign('lang_editdesc', _MD_YOGURT_EDIT_DESC);
365
$xoopsTpl->assign('lang_visitors', _MD_YOGURT_VISITORS);
366
$xoopsTpl->assign('lang_profilevisitors', _MD_YOGURT_PROFILEVISITORS);
367
$xoopsTpl->assign('lang_editprofile', _MD_YOGURT_EDITPROFILE);
368
369
$xoopsTpl->assign('user_uname', $thisUser->getVar('uname'));
370
$xoopsTpl->assign('user_realname', $thisUser->getVar('name'));
371
$xoopsTpl->assign('lang_uname', _US_NICKNAME);
372
$xoopsTpl->assign('lang_website', _US_WEBSITE);
373
$userwebsite = '' !== $thisUser->getVar('url', 'E') ? '<a href="' . $thisUser->getVar(
374
        'url',
375
        'E'
376
    ) . '" target="_blank">' . $thisUser->getVar(
377
        'url'
378
    ) . '</a>' : '';
379
$xoopsTpl->assign('user_websiteurl', $userwebsite);
380
$xoopsTpl->assign('lang_email', _US_EMAIL);
381
$xoopsTpl->assign('lang_privmsg', _US_PM);
382
$xoopsTpl->assign('lang_location', _US_LOCATION);
383
$xoopsTpl->assign('user_location', $thisUser->getVar('user_from'));
384
$xoopsTpl->assign('lang_occupation', _US_OCCUPATION);
385
$xoopsTpl->assign('user_occupation', $thisUser->getVar('user_occ'));
386
$xoopsTpl->assign('lang_interest', _US_INTEREST);
387
$xoopsTpl->assign('user_interest', $thisUser->getVar('user_intrest'));
388
$xoopsTpl->assign('lang_extrainfo', _US_EXTRAINFO);
389
$var = $thisUser->getVar('bio', 'N');
390
$xoopsTpl->assign('user_extrainfo', $myts->displayTarea($var, 0, 1, 1));
391
$xoopsTpl->assign('lang_statistics', _US_STATISTICS);
392
$xoopsTpl->assign('lang_membersince', _US_MEMBERSINCE);
393
$var = $thisUser->getVar('user_regdate');
394
$xoopsTpl->assign('user_joindate', formatTimestamp($var, 's'));
395
$xoopsTpl->assign('lang_rank', _US_RANK);
396
$xoopsTpl->assign('lang_posts', _US_POSTS);
397
$xoopsTpl->assign('lang_basicInfo', _US_BASICINFO);
398
$xoopsTpl->assign('lang_more', _US_MOREABOUT);
399
$xoopsTpl->assign('lang_myinfo', _US_MYINFO);
400
$xoopsTpl->assign('user_posts', $thisUser->getVar('posts'));
401
$xoopsTpl->assign('lang_lastlogin', _US_LASTLOGIN);
402
$date = $thisUser->getVar('last_login');
403
if (!empty($date)) {
404
    $xoopsTpl->assign('user_lastlogin', formatTimestamp($date, 'm'));
405
}
406
$xoopsTpl->assign('lang_notregistered', _US_NOTREGISTERED);
407
408
$xoopsTpl->assign('lang_signature', _US_SIGNATURE);
409
$var = $thisUser->getVar('user_sig', 'N');
410
$xoopsTpl->assign('user_signature', $myts->displayTarea($var, 0, 1, 1));
411
412
$xoopsTpl->assign('user_viewemail', $thisUser->getVar('user_viewemail', 'E'));
413
if (1 === $thisUser->getVar('user_viewemail')) {
414
    $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
415
} else {
416
    $xoopsTpl->assign('user_email', '&nbsp;');
417
}
418
419
$xoopsTpl->assign('user_onlinestatus', $thisUser->isOnline());
420
$xoopsTpl->assign('lang_onlinestatus', _MD_YOGURT_ONLINESTATUS);
421
$xoopsTpl->assign('uname', $thisUser->getVar('uname'));
422
$xoopsTpl->assign('lang_realname', _US_REALNAME);
423
$xoopsTpl->assign('name', $thisUser->getVar('name'));
424
425
$gpermHandler  = xoops_getHandler('groupperm');
426
$groups        = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
427
$moduleHandler = xoops_getHandler('module');
428
$criteria      = new CriteriaCompo(new Criteria('hassearch', 1));
429
$criteria->add(new Criteria('isactive', 1));
430
$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

430
$mids = array_keys($moduleHandler->/** @scrutinizer ignore-call */ getList($criteria));
Loading history...
431
432
//user rank
433
$userrank = $thisUser->rank();
434
if ($userrank['image']) {
435
    $xoopsTpl->assign('user_rankimage', '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="">');
436
}
437
$xoopsTpl->assign('user_ranktitle', $userrank['title']);
438
439
foreach ($mids as $mid) {
440
    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

440
    if ($gpermHandler->/** @scrutinizer ignore-call */ checkRight('module_read', $mid, $groups)) {
Loading history...
441
        $module   = $moduleHandler->get($mid);
442
        $user_uid = $thisUser->getVar('uid');
443
        $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

443
        /** @scrutinizer ignore-call */ 
444
        $results  = $module->search('', '', 5, 0, $user_uid);
Loading history...
444
        if (is_array($results)) {
445
            $count = count($results);
446
        }
447
        if (is_array($results) && $count > 0) {
448
            for ($i = 0; $i < $count; $i++) {
449
                if (isset($results[$i]['image']) && '' !== $results[$i]['image']) {
450
                    $results[$i]['image'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['image'];
451
                } else {
452
                    $results[$i]['image'] = 'images/icons/posticon2.gif';
453
                }
454
455
                if (!preg_match("#^http[s]*:\/\/#i", $results[$i]['link'])) {
456
                    $results[$i]['link'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['link'];
457
                }
458
459
                $results[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']);
460
                $results[$i]['time']  = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
461
            }
462
            if (5 === $count) {
463
                $showall_link = '<a href="../../search.php?action=showallbyuser&amp;mid=' . $mid . '&amp;uid=' . $thisUser->getVar(
464
                        'uid'
465
                    ) . '">' . _US_SHOWALL . '</a>';
466
            } else {
467
                $showall_link = '';
468
            }
469
            $xoopsTpl->append(
470
                'modules',
471
                [
472
                    'name'         => $module->getVar('name'),
473
                    'results'      => $results,
474
                    'showall_link' => $showall_link,
475
                ]
476
            );
477
        }
478
        unset($module);
479
    }
480
}
481
482
483
484
485
require __DIR__ . '/footer.php';
486
require dirname(__DIR__, 2) . '/footer.php';
487