Passed
Push — master ( 95e0c4...fc8ab0 )
by
unknown
44s queued 15s
created
Labels
Severity
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
use XoopsModules\Suico\IndexController;
25
26
/**
27
 * Xoops header
28
 */
29
$GLOBALS['xoopsOption']['template_main'] = 'suico_index.tpl';
30
require __DIR__ . '/header.php';
31
$helper->loadLanguage('user');
32
$controller = new IndexController($xoopsDB, $xoopsUser);
33
/**
34
 * Fetching numbers of groups friends videos pictures etc...
35
 */
36
$nbSections = $controller->getNumbersSections();
37
$uid        = $controller->uidOwner;
38
$categories = [];
39
/* @var  XoopsGroupPermHandler $grouppermHandler */
40
$grouppermHandler = xoops_getHandler('groupperm');
41
$groups           = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : [XOOPS_GROUP_ANONYMOUS];
42
if (is_object($GLOBALS['xoopsUser']) && $uid == $GLOBALS['xoopsUser']->getVar('uid')) {
43
    //disable cache
44
    $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
45
    include $GLOBALS['xoops']->path('header.php');
46
    /* @var XoopsConfigHandler $configHandler */
47
    $configHandler             = xoops_getHandler('config');
48
    $GLOBALS['xoopsConfigUser'] = $configHandler->getConfigsByCat(XOOPS_CONF_USER);
49
    $GLOBALS['xoopsTpl']->assign('user_ownpage', true);
50
    if (1 == $GLOBALS['xoopsConfigUser']['self_delete']) {
51
        $GLOBALS['xoopsTpl']->assign('user_candelete', true);
52
        $GLOBALS['xoopsTpl']->assign('lang_deleteaccount', _US_DELACCOUNT);
53
    } else {
54
        $GLOBALS['xoopsTpl']->assign('user_candelete', false);
55
    }
56
    $GLOBALS['xoopsTpl']->assign('user_changeemail', $GLOBALS['xoopsConfigUser']['allow_chgmail']);
57
    $thisUser = &$GLOBALS['xoopsUser'];
58
} else {
59
    /* @var XoopsMemberHandler $memberHandler */
60
    $memberHandler = xoops_getHandler('member');
61
    $thisUser      = $memberHandler->getUser($uid);
62
    // Redirect if not a user or not active and the current user is not admin
63
    if (!is_object($thisUser) || (!$thisUser->isActive() && (!$GLOBALS['xoopsUser'] || !$GLOBALS['xoopsUser']->isAdmin()))) {
64
        redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n'), 3, _US_SELECTNG);
65
    }
66
    /**
67
     * Access permission check
68
     *
69
     * Note:
70
     * "thisUser" refers to the user whose profile will be accessed; "xoopsUser" refers to the current user $GLOBALS['xoopsUser']
71
     * "Basic Groups" refer to XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS and XOOPS_GROUP_ANONYMOUS;
72
     * "Non Basic Groups" refer to all other custom groups
73
     *
74
     * 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
75
     * 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
76
     * 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
77
     */
78
    // Redirect if current user is not allowed to access the user's profile based on group permission
79
    $groups_basic             = [XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS, XOOPS_GROUP_ANONYMOUS];
80
    $groups_thisUser          = $thisUser->getGroups();
81
    $groups_thisUser_nonbasic = array_diff($groups_thisUser, $groups_basic);
82
    $groups_xoopsUser         = $groups;
83
    /* @var  XoopsGroupPermHandler $grouppermHandler */
84
    $grouppermHandler  = xoops_getHandler('groupperm');
85
    $groups_accessible = $grouppermHandler->getItemIds('profile_access', $groups_xoopsUser, $GLOBALS['xoopsModule']->getVar('mid'));
86
    $rejected = false;
87
    if ($thisUser->isAdmin()) {
88
        $rejected = !in_array(XOOPS_GROUP_ADMIN, $groups_accessible);
89
    } elseif ($groups_thisUser_nonbasic) {
90
        $rejected = !array_intersect($groups_thisUser_nonbasic, $groups_accessible);
91
    } else {
92
        $rejected = !in_array(XOOPS_GROUP_USERS, $groups_accessible);
93
    }
94
    if ($rejected) {
95
        // redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n'), 3, _NOPERM);
96
    }
97
    if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin()) {
98
        //disable cache
99
        $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
100
    }
101
    $GLOBALS['xoopsTpl']->assign('user_ownpage', false);
102
}
103
$GLOBALS['xoopsTpl']->assign('user_uid', $thisUser->getVar('uid'));
104
if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin()) {
105
    $GLOBALS['xoopsTpl']->assign('lang_editprofile', _US_EDITPROFILE);
106
    $GLOBALS['xoopsTpl']->assign('lang_deleteaccount', _US_DELACCOUNT);
107
    $GLOBALS['xoopsTpl']->assign('userlevel', $thisUser->isActive());
108
}
109
// Dynamic User Profiles
110
$thisUsergroups     = $thisUser->getGroups();
111
$visibilityHandler = $helper->getHandler('Visibility');
112
//search for visible Fields or null for none
113
$field_ids_visible = $visibilityHandler->getVisibleFields($thisUsergroups, $groups);
114
$profileHandler = $helper->getHandler('Profile');
115
$fields          = $profileHandler->loadFields();
116
$categoryHandler     = $helper->getHandler('Category');
117
$cat_crit        = new CriteriaCompo();
118
$cat_crit->setSort('cat_weight');
119
$cats = $categoryHandler->getObjects($cat_crit, true, false);
120
unset($cat_crit);
121
$avatar = '';
122
if ($thisUser->getVar('user_avatar') && 'blank.gif' !== $thisUser->getVar('user_avatar')) {
123
    $avatar = XOOPS_UPLOAD_URL . '/' . $thisUser->getVar('user_avatar');
124
}
125
foreach (array_keys($cats) as $i) {
126
    $categories[$i] = $cats[$i];
127
}
128
$profileHandler = $helper->getHandler('Profile');
129
$profile         = $profileHandler->get($thisUser->getVar('uid'));
130
// Add dynamic fields
131
foreach (array_keys($fields) as $i) {
132
    //If field is not visible, skip
133
    //if ( $field_ids_visible && !in_array($fields[$i]->getVar('field_id'), $field_ids_visible) ) continue;
134
    if (!in_array($fields[$i]->getVar('field_id'), $field_ids_visible)) {
135
        continue;
136
    }
137
    $cat_id = $fields[$i]->getVar('cat_id');
138
    $value  = $fields[$i]->getOutputValue($thisUser, $profile);
139
    if (is_array($value)) {
140
        $value = implode('<br>', array_values($value));
141
    }
142
    if ($value) {
143
        $categories[$cat_id]['fields'][] = ['title' => $fields[$i]->getVar('field_title'), 'value' => $value];
144
        $weights[$cat_id][]              = $fields[$i]->getVar('cat_id');
145
    }
146
}
147
$GLOBALS['xoopsTpl']->assign('categories', $categories);
148
// Dynamic user profiles end
149
$featuredvideocode = '';
150
$featuredvideotitle = '';
151
$featuredvideodesc = '';
152
//require_once __DIR__ . '/class/suico_controller.php';
153
//if (!@ require_once XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/user.php') {
154
//    require_once XOOPS_ROOT_PATH . '/language/english/user.php';
155
//}
156
/**
157
 * This variable define the beginning of the navigation must be
158
 * set here so all calls to database will take this into account
159
 */
160
$start = Request::getInt(
161
    'start',
162
    0,
163
    'GET'
164
);
165
/**
166
 * Criteria for featuredvideo
167
 */
168
$criteriaUidVideo   = new Criteria('uid_owner', $controller->uidOwner);
169
$criteria_featuredvideo = new Criteria('featured_video', '1');
170
$criteria_video     = new CriteriaCompo($criteria_featuredvideo);
171
$criteria_video->add($criteriaUidVideo);
172
if ((isset($nbSections['countVideos']) && $nbSections['countVideos'] > 0) && ($videos = $controller->videosFactory->getObjects($criteria_video))) {
173
    $featuredvideocode = $videos[0]->getVar('youtube_code');
174
	$featuredvideotitle = $videos[0]->getVar('video_title');
175
    $featuredvideodesc = $videos[0]->getVar('video_desc');
176
}
177
/**
178
 * Groups
179
 */
180
$criteria_groups = new Criteria('rel_user_uid', $controller->uidOwner);
181
$groups          = $controller->relgroupusersFactory->getGroups(8, $criteria_groups);
182
/**
183
 * Visitors
184
 */
185
$controller->visitorsFactory->purgeVisits();
186
if (0 === $controller->isAnonym) {
187
    /**
188
     * Fetching last visitors
189
     */
190
    if ($controller->uidOwner !== $xoopsUser->getVar('uid')) {
191
        $visitor_now = $controller->visitorsFactory->create();
192
        $visitor_now->setVar('uid_owner', $controller->uidOwner);
193
        $visitor_now->setVar('uid_visitor', $xoopsUser->getVar('uid'));
194
        $visitor_now->setVar('uname_visitor', $xoopsUser->getVar('uname'));
195
        $controller->visitorsFactory->insert2($visitor_now);
196
    }
197
    $criteria_visitors = new Criteria('uid_owner', $controller->uidOwner);
198
    //$criteria_visitors->setLimit(5);
199
    $visitorsObjectArray = $controller->visitorsFactory->getObjects(
200
        $criteria_visitors
201
    );
202
    /**
203
     * Lets populate an array with the data from visitors
204
     */
205
    $i             = 0;
206
    $visitorsArray = [];
207
    if (is_array($visitorsObjectArray) && count($visitorsObjectArray) > 0) {
208
        foreach ($visitorsObjectArray as $visitor) {
209
            if (null !== $visitor) {
210
                $indice                 = $visitor->getVar('uid_visitor', 's');
211
                $visitorsArray[$indice] = $visitor->getVar('uname_visitor', 's');
212
                $i++;
213
            }
214
        }
215
    }
216
    $xoopsTpl->assign('visitors', $visitorsArray);
217
    $xoopsTpl->assign('lang_visitors', _MD_SUICO_VISITORS);
218
    /*    $criteria_deletevisitors = new criteria('uid_owner',$uid);
219
        $criteria_deletevisitors->setStart(5);
220
221
        print_r($criteria_deletevisitors);
222
        $visitorsFactory->deleteAll($criteria_deletevisitors, true);
223
    */
224
}
225
$avatar = $controller->owner->getVar('user_avatar');
226
$memberHandler = xoops_getHandler('member');
227
$thisUser      = $memberHandler->getUser($controller->uidOwner);
228
$myts          = MyTextSanitizer::getInstance();
229
//navbar
230
$xoopsTpl->assign('lang_mysection', _MD_SUICO_MYPROFILE);
231
$xoopsTpl->assign('section_name', _MD_SUICO_PROFILE);
232
//$xoopsTpl->assign('path_suico_uploads',$helper->getConfig('link_path_upload'));
233
//groups
234
$xoopsTpl->assign('groups', $groups);
235
if (isset($nbSections['countGroups']) && $nbSections['countGroups'] <= 0) {
236
    $xoopsTpl->assign('lang_nogroupsyet', _MD_SUICO_NOGROUPSYET);
237
}
238
$xoopsTpl->assign('lang_viewallgroups', _MD_SUICO_ALLGROUPS);
239
//Avatar and Main
240
$xoopsTpl->assign('avatar_url', $avatar);
241
$xoopsTpl->assign('lang_selectavatar', _MD_SUICO_SELECTAVATAR);
242
$xoopsTpl->assign('lang_selectfeaturedvideo', _MD_SUICO_SELECTFEATUREDVIDEO);
243
$xoopsTpl->assign('lang_noavatar', _MD_SUICO_NOAVATARYET);
244
$xoopsTpl->assign('lang_nofeaturedvideo', _MD_SUICO_NOFEATUREDVIDEOYET);
245
$xoopsTpl->assign('lang_featuredvideo', _MD_SUICO_VIDEO_FEATURED);
246
$xoopsTpl->assign('lang_viewallvideos', _MD_SUICO_ALLVIDEOS);
247
if (isset($nbSections['countGroups']) && $nbSections['countGroups'] > 0) {
248
    $xoopsTpl->assign('featuredvideocode', $featuredvideocode);
249
    $xoopsTpl->assign('featuredvideodesc', $featuredvideodesc);
250
	$xoopsTpl->assign('featuredvideotitle', $featuredvideotitle);
251
    $xoopsTpl->assign(
252
        'width',
253
        $helper->getConfig('width_maintube')
254
    ); // Falta configurar o tamnho do main nas configs e alterar no template
255
    $xoopsTpl->assign(
256
        'height',
257
        $helper->getConfig('height_maintube')
258
    );
259
}
260
/**
261
 * Friends
262
 */
263
if ($xoopsUser) {
264
    $controller = new Suico\FriendsController($xoopsDB, $xoopsUser);
265
    $friendrequest = 0;
266
    if (1 === $controller->isOwner) {
267
        $criteria_uidfriendrequest = new Criteria('friendrequestto_uid', $controller->uidOwner);
268
        $newFriendrequest          = $controller->friendrequestFactory->getObjects($criteria_uidfriendrequest);
269
        if ($newFriendrequest) {
270
            $countFriendrequest     = count($newFriendrequest);
271
            $memberHandler = xoops_getHandler('member');
272
            $friendrequester        = $memberHandler->getUser($newFriendrequest[0]->getVar('friendrequester_uid'));
273
            $friendrequester_uid    = $friendrequester->getVar('uid');
274
            $friendrequester_uname  = $friendrequester->getVar('uname');
275
            $friendrequester_avatar = $friendrequester->getVar('user_avatar');
276
            $friendrequest_id       = $newFriendrequest[0]->getVar('friendreq_id');
277
            $friendrequest          = 1;
278
        }
279
    }
280
    //requests to become friend
281
    if (1 === $friendrequest) {
282
        $xoopsTpl->assign('lang_you_have_x_friendrequests', sprintf(_MD_SUICO_YOU_HAVE_X_FRIENDREQUESTS, $countFriendrequest));
283
        $xoopsTpl->assign('friendrequester_uid', $friendrequester_uid);
284
        $xoopsTpl->assign('friendrequester_uname', $friendrequester_uname);
285
        $xoopsTpl->assign('friendrequester_avatar', $friendrequester_avatar);
286
        $xoopsTpl->assign('friendrequest', $friendrequest);
287
        $xoopsTpl->assign('friendrequest_id', $friendrequest_id);
288
        $xoopsTpl->assign('lang_rejected', _MD_SUICO_UNKNOWN_REJECTING);
289
        $xoopsTpl->assign('lang_accepted', _MD_SUICO_UNKNOWN_ACCEPTING);
290
        $xoopsTpl->assign('lang_acquaintance', _MD_SUICO_AQUAITANCE);
291
        $xoopsTpl->assign('lang_friend', _MD_SUICO_FRIEND);
292
        $xoopsTpl->assign('lang_bestfriend', _MD_SUICO_BESTFRIEND);
293
        $linkedpetioner = '<a href="index.php?uid=' . $friendrequester_uid . '">' . $friendrequester_uname . '</a>';
294
        $xoopsTpl->assign('lang_askingfriend', sprintf(_MD_SUICO_ASKINGFRIEND, $linkedpetioner));
295
    }
296
}
297
$xoopsTpl->assign('lang_askusertobefriend', _MD_SUICO_ASKBEFRIEND);
298
$xoopsTpl->assign('lang_addfriend', _MD_SUICO_ADDFRIEND);
299
$xoopsTpl->assign('lang_friendrequestpending', _MD_SUICO_FRIENDREQUEST_PENDING);
300
$xoopsTpl->assign('lang_myfriend', _MD_SUICO_MYFRIEND);
301
$xoopsTpl->assign('lang_friendrequestsent', _MD_SUICO_FRIENDREQUEST_SENT);
302
$xoopsTpl->assign('lang_acceptfriend', _MD_SUICO_FRIEND_ACCEPT);
303
$xoopsTpl->assign('lang_rejectfriend', _MD_SUICO_FRIEND_REJECT);
304
$criteria_friends = new Criteria('friend1_uid', $controller->uidOwner);
305
$friends          = $controller->friendshipsFactory->getFriends(8, $criteria_friends);
306
$xoopsTpl->assign('friends', $friends);
307
$xoopsTpl->assign('lang_friendstitle', sprintf(_MD_SUICO_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

307
$xoopsTpl->assign('lang_friendstitle', sprintf(_MD_SUICO_FRIENDSTITLE, /** @scrutinizer ignore-type */ $controller->nameOwner));
Loading history...
308
$xoopsTpl->assign('lang_viewallfriends', _MD_SUICO_ALLFRIENDS);
309
$xoopsTpl->assign('lang_nofriendsyet', _MD_SUICO_NOFRIENDSYET);
310
//search
311
$xoopsTpl->assign('lang_usercontributions', _MD_SUICO_USER_CONTRIBUTIONS);
312
//Profile
313
$xoopsTpl->assign('lang_detailsinfo', _MD_SUICO_USER_DETAILS);
314
$xoopsTpl->assign('lang_contactinfo', _MD_SUICO_CONTACTINFO);
315
//$xoopsTpl->assign('path_suico_uploads',$helper->getConfig('link_path_upload'));
316
$xoopsTpl->assign(
317
    'lang_max_countPicture',
318
    sprintf(_MD_SUICO_YOUCANHAVE, $helper->getConfig('countPicture'))
319
);
320
$xoopsTpl->assign('lang_delete', _MD_SUICO_DELETE);
321
$xoopsTpl->assign('lang_visitors', _MD_SUICO_VISITORS);
322
$xoopsTpl->assign('lang_profilevisitors', _MD_SUICO_PROFILEVISITORS);
323
$xoopsTpl->assign('lang_editprofile', _MD_SUICO_EDITPROFILE);
324
$xoopsTpl->assign('user_uname', $thisUser->getVar('uname'));
325
$xoopsTpl->assign('user_realname', $thisUser->getVar('name'));
326
$xoopsTpl->assign('lang_uname', _US_NICKNAME);
327
$xoopsTpl->assign('lang_website', _US_WEBSITE);
328
$userwebsite = '' !== $thisUser->getVar('url', 'E') ? '<a href="' . $thisUser->getVar(
329
        'url',
330
        'E'
331
    ) . '" target="_blank">' . $thisUser->getVar(
332
        'url'
333
    ) . '</a>' : '';
334
$xoopsTpl->assign('user_websiteurl', $userwebsite);
335
$xoopsTpl->assign('lang_email', _US_EMAIL);
336
$xoopsTpl->assign('lang_privmsg', _US_PM);
337
$xoopsTpl->assign('lang_location', _US_LOCATION);
338
$xoopsTpl->assign('user_location', $thisUser->getVar('user_from'));
339
$xoopsTpl->assign('lang_occupation', _US_OCCUPATION);
340
$xoopsTpl->assign('user_occupation', $thisUser->getVar('user_occ'));
341
$xoopsTpl->assign('lang_interest', _US_INTEREST);
342
$xoopsTpl->assign('user_interest', $thisUser->getVar('user_intrest'));
343
$xoopsTpl->assign('lang_extrainfo', _US_EXTRAINFO);
344
$var = $thisUser->getVar('bio', 'N');
345
$xoopsTpl->assign('user_extrainfo', $myts->displayTarea($var, 0, 1, 1));
346
$xoopsTpl->assign('lang_statistics', _US_STATISTICS);
347
$xoopsTpl->assign('lang_membersince', _US_MEMBERSINCE);
348
$var = $thisUser->getVar('user_regdate');
349
$xoopsTpl->assign('user_joindate', formatTimestamp($var, 's'));
350
$xoopsTpl->assign('lang_rank', _US_RANK);
351
$xoopsTpl->assign('lang_posts', _US_POSTS);
352
$xoopsTpl->assign('lang_basicInfo', _US_BASICINFO);
353
$xoopsTpl->assign('lang_more', _US_MOREABOUT);
354
$xoopsTpl->assign('lang_myinfo', _US_MYINFO);
355
$xoopsTpl->assign('user_posts', $thisUser->getVar('posts'));
356
$xoopsTpl->assign('lang_lastlogin', _US_LASTLOGIN);
357
$date = $thisUser->getVar('last_login');
358
if (!empty($date)) {
359
    $xoopsTpl->assign('user_lastlogin', formatTimestamp($date, 'm'));
360
}
361
$xoopsTpl->assign('lang_notregistered', _US_NOTREGISTERED);
362
$xoopsTpl->assign('lang_signature', _US_SIGNATURE);
363
$var = $thisUser->getVar('user_sig', 'N');
364
$xoopsTpl->assign('user_signature', $myts->displayTarea($var, 0, 1, 1));
365
$xoopsTpl->assign('user_viewemail', $thisUser->getVar('user_viewemail', 'E'));
366
if (1 === $thisUser->getVar('user_viewemail')) {
367
    $xoopsTpl->assign('user_email', $thisUser->getVar('email', 'E'));
368
} else {
369
    $xoopsTpl->assign('user_email', '&nbsp;');
370
}
371
$xoopsTpl->assign('user_onlinestatus', $thisUser->isOnline());
372
$xoopsTpl->assign('lang_onlinestatus', _MD_SUICO_ONLINESTATUS);
373
$xoopsTpl->assign('uname', $thisUser->getVar('uname'));
374
$xoopsTpl->assign('lang_realname', _US_REALNAME);
375
$xoopsTpl->assign('name', $thisUser->getVar('name'));
376
$gpermHandler  = xoops_getHandler('groupperm');
377
$groups        = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
378
$moduleHandler = xoops_getHandler('module');
379
$criteria      = new CriteriaCompo(new Criteria('hassearch', 1));
380
$criteria->add(new Criteria('isactive', 1));
381
$mids = array_keys($moduleHandler->getList($criteria));
382
//user rank
383
$userrank = $thisUser->rank();
384
if ($userrank['image']) {
385
    $xoopsTpl->assign('user_rankimage', '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="">');
386
}
387
$xoopsTpl->assign('user_ranktitle', $userrank['title']);
388
foreach ($mids as $mid) {
389
    if ($gpermHandler->checkRight('module_read', $mid, $groups)) {
390
        $module   = $moduleHandler->get($mid);
391
        $user_uid = $thisUser->getVar('uid');
392
        $results  = $module->search('', '', 5, 0, $user_uid);
393
        if (is_array($results)) {
394
            $count = count($results);
395
        }
396
        if (is_array($results) && $count > 0) {
397
            for ($i = 0; $i < $count; $i++) {
398
                if (isset($results[$i]['image']) && '' !== $results[$i]['image']) {
399
                    $results[$i]['image'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['image'];
400
                } else {
401
                    $results[$i]['image'] = 'images/icons/posticon2.gif';
402
                }
403
                if (!preg_match("#^http[s]*:\/\/#i", $results[$i]['link'])) {
404
                    $results[$i]['link'] = 'modules/' . $module->getVar('dirname') . '/' . $results[$i]['link'];
405
                }
406
                $results[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']);
407
                $results[$i]['time']  = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
408
            }
409
            if (5 === $count) {
410
                $showall_link = '<a href="../../search.php?action=showallbyuser&amp;mid=' . $mid . '&amp;uid=' . $thisUser->getVar(
411
                        'uid'
412
                    ) . '">' . _US_SHOWALL . '</a>';
413
            } else {
414
                $showall_link = '';
415
            }
416
            $xoopsTpl->append(
417
                'modules',
418
                [
419
                    'name'         => $module->getVar('name'),
420
                    'results'      => $results,
421
                    'showall_link' => $showall_link,
422
                ]
423
            );
424
        }
425
        unset($module);
426
    }
427
}
428
require __DIR__ . '/footer.php';
429
require dirname(__DIR__, 2) . '/footer.php';
430