This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php declare(strict_types=1); |
||||||
2 | /* |
||||||
3 | You may not change or alter any portion of this comment or credits |
||||||
4 | of supporting developers from this source code or any supporting source code |
||||||
5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||||||
6 | |||||||
7 | This program is distributed in the hope that it will be useful, |
||||||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||||
10 | */ |
||||||
11 | |||||||
12 | /** |
||||||
13 | * @category Module |
||||||
14 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||||
15 | * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||||||
16 | * @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||||||
17 | */ |
||||||
18 | |||||||
19 | use Xmf\Request; |
||||||
0 ignored issues
–
show
|
|||||||
20 | use XoopsModules\Suico\{ |
||||||
21 | FriendsController, |
||||||
22 | IndexController |
||||||
23 | }; |
||||||
24 | |||||||
25 | /** |
||||||
26 | * Xoops header |
||||||
27 | */ |
||||||
28 | $GLOBALS['xoopsOption']['template_main'] = 'suico_index.tpl'; |
||||||
29 | require __DIR__ . '/header.php'; |
||||||
30 | $helper->loadLanguage('user'); |
||||||
31 | $controller = new IndexController($xoopsDB, $xoopsUser); |
||||||
32 | /** |
||||||
33 | * Fetching numbers of groups friends videos pictures etc... |
||||||
34 | */ |
||||||
35 | $nbSections = $controller->getNumbersSections(); |
||||||
36 | $uid = $controller->uidOwner; |
||||||
37 | $categories = []; |
||||||
38 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||||
39 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
40 | $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : [XOOPS_GROUP_ANONYMOUS]; |
||||||
41 | if (is_object($GLOBALS['xoopsUser']) && $uid == $GLOBALS['xoopsUser']->getVar('uid')) { |
||||||
42 | //disable cache |
||||||
43 | $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0; |
||||||
44 | // include $GLOBALS['xoops']->path('header.php'); |
||||||
45 | /** @var XoopsConfigHandler $configHandler */ |
||||||
46 | $configHandler = xoops_getHandler('config'); |
||||||
47 | $GLOBALS['xoopsConfigUser'] = $configHandler->getConfigsByCat(XOOPS_CONF_USER); |
||||||
48 | $GLOBALS['xoopsTpl']->assign('user_ownpage', true); |
||||||
49 | if (1 == $GLOBALS['xoopsConfigUser']['self_delete']) { |
||||||
50 | $GLOBALS['xoopsTpl']->assign('user_candelete', true); |
||||||
51 | $GLOBALS['xoopsTpl']->assign('lang_deleteaccount', _US_DELACCOUNT); |
||||||
52 | } else { |
||||||
53 | $GLOBALS['xoopsTpl']->assign('user_candelete', false); |
||||||
54 | } |
||||||
55 | $GLOBALS['xoopsTpl']->assign('user_changeemail', $GLOBALS['xoopsConfigUser']['allow_chgmail']); |
||||||
56 | $thisUser = &$GLOBALS['xoopsUser']; |
||||||
57 | } else { |
||||||
58 | /** @var XoopsMemberHandler $memberHandler */ |
||||||
59 | $memberHandler = xoops_getHandler('member'); |
||||||
60 | $thisUser = $memberHandler->getUser($uid); |
||||||
61 | // Redirect if not a user or not active and the current user is not admin |
||||||
62 | if (!is_object($thisUser) || (!$thisUser->isActive() && (!$GLOBALS['xoopsUser'] || !$GLOBALS['xoopsUser']->isAdmin()))) { |
||||||
63 | redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n'), 3, _US_SELECTNG); |
||||||
64 | } |
||||||
65 | /** |
||||||
66 | * Access permission check |
||||||
67 | * |
||||||
68 | * Note: |
||||||
69 | * "thisUser" refers to the user whose profile will be accessed; "xoopsUser" refers to the current user $GLOBALS['xoopsUser'] |
||||||
70 | * "Basic Groups" refer to XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS and XOOPS_GROUP_ANONYMOUS; |
||||||
71 | * "Non Basic Groups" refer to all other custom groups |
||||||
72 | * |
||||||
73 | * 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 |
||||||
74 | * 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 |
||||||
75 | * 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 |
||||||
76 | */ |
||||||
77 | // Redirect if current user is not allowed to access the user's profile based on group permission |
||||||
78 | $groups_basic = [XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS, XOOPS_GROUP_ANONYMOUS]; |
||||||
79 | $groups_thisUser = $thisUser->getGroups(); |
||||||
80 | $groups_thisUser_nonbasic = array_diff($groups_thisUser, $groups_basic); |
||||||
81 | $groups_xoopsUser = $groups; |
||||||
82 | /** @var XoopsGroupPermHandler $grouppermHandler */ |
||||||
83 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
84 | $groups_accessible = $grouppermHandler->getItemIds('profile_access', $groups_xoopsUser, $helper->getModule()->getVar('mid')); |
||||||
85 | $rejected = false; |
||||||
86 | if ($thisUser->isAdmin()) { |
||||||
87 | $rejected = !in_array(XOOPS_GROUP_ADMIN, $groups_accessible, true); |
||||||
88 | } elseif ($groups_thisUser_nonbasic) { |
||||||
0 ignored issues
–
show
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 ![]() |
|||||||
89 | $rejected = !array_intersect($groups_thisUser_nonbasic, $groups_accessible); |
||||||
90 | } else { |
||||||
91 | $rejected = !in_array(XOOPS_GROUP_USERS, $groups_accessible, true); |
||||||
92 | } |
||||||
93 | if ($rejected) { |
||||||
94 | // redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n'), 3, _NOPERM); |
||||||
95 | } |
||||||
96 | if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin()) { |
||||||
97 | //disable cache |
||||||
98 | $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0; |
||||||
99 | } |
||||||
100 | $GLOBALS['xoopsTpl']->assign('user_ownpage', false); |
||||||
101 | } |
||||||
102 | $GLOBALS['xoopsTpl']->assign('user_uid', $thisUser->getVar('uid')); |
||||||
103 | if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin()) { |
||||||
104 | $GLOBALS['xoopsTpl']->assign('lang_editprofile', _US_EDITPROFILE); |
||||||
105 | $GLOBALS['xoopsTpl']->assign('lang_deleteaccount', _US_DELACCOUNT); |
||||||
106 | $GLOBALS['xoopsTpl']->assign('userlevel', $thisUser->isActive()); |
||||||
107 | } |
||||||
108 | // Dynamic User Profiles |
||||||
109 | $thisUsergroups = $thisUser->getGroups(); |
||||||
110 | $visibilityHandler = $helper->getHandler('Visibility'); |
||||||
111 | //search for visible Fields or null for none |
||||||
112 | $field_ids_visible = $visibilityHandler->getVisibleFields($thisUsergroups, $groups); |
||||||
113 | $profileHandler = $helper->getHandler('Profile'); |
||||||
114 | $fields = $profileHandler->loadFields(); |
||||||
115 | $categoryHandler = $helper->getHandler('Category'); |
||||||
116 | $categoryCriteria = new CriteriaCompo(); |
||||||
117 | $categoryCriteria->setSort('cat_weight'); |
||||||
118 | $cats = $categoryHandler->getObjects($categoryCriteria, true, false); |
||||||
119 | unset($categoryCriteria); |
||||||
120 | $avatar = ''; |
||||||
121 | if ($thisUser->getVar('user_avatar') && 'blank.gif' !== $thisUser->getVar('user_avatar')) { |
||||||
122 | $avatar = XOOPS_UPLOAD_URL . '/' . $thisUser->getVar('user_avatar'); |
||||||
123 | } |
||||||
124 | foreach (array_keys($cats) as $i) { |
||||||
125 | $categories[$i] = $cats[$i]; |
||||||
126 | } |
||||||
127 | $profileHandler = $helper->getHandler('Profile'); |
||||||
128 | $profile = $profileHandler->get($thisUser->getVar('uid')); |
||||||
129 | // Add dynamic fields |
||||||
130 | foreach (array_keys($fields) as $i) { |
||||||
131 | //If field is not visible, skip |
||||||
132 | //if ( $field_ids_visible && !in_array($fields[$i]->getVar('field_id'), $field_ids_visible) ) continue; |
||||||
133 | if (!in_array($fields[$i]->getVar('field_id'), $field_ids_visible, true)) { |
||||||
134 | continue; |
||||||
135 | } |
||||||
136 | $cat_id = $fields[$i]->getVar('cat_id'); |
||||||
137 | $value = $fields[$i]->getOutputValue($thisUser, $profile); |
||||||
138 | if (is_array($value)) { |
||||||
139 | $value = implode('<br>', array_values($value)); |
||||||
140 | } |
||||||
141 | if ($value) { |
||||||
142 | $categories[$cat_id]['fields'][] = ['title' => $fields[$i]->getVar('field_title'), 'value' => $value]; |
||||||
143 | $weights[$cat_id][] = $fields[$i]->getVar('cat_id'); |
||||||
144 | } |
||||||
145 | } |
||||||
146 | $GLOBALS['xoopsTpl']->assign('categories', $categories); |
||||||
147 | // Dynamic user profiles end |
||||||
148 | $featuredvideocode = ''; |
||||||
149 | $featuredvideotitle = ''; |
||||||
150 | $featuredvideodesc = ''; |
||||||
151 | //require_once __DIR__ . '/class/suico_controller.php'; |
||||||
152 | //if (!@ require_once XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/user.php') { |
||||||
153 | // require_once XOOPS_ROOT_PATH . '/language/english/user.php'; |
||||||
154 | //} |
||||||
155 | /** |
||||||
156 | * This variable define the beginning of the navigation must be |
||||||
157 | * set here so all calls to database will take this into account |
||||||
158 | */ |
||||||
159 | $start = Request::getInt('start', 0, 'GET'); |
||||||
160 | /** |
||||||
161 | * Criteria for featuredvideo |
||||||
162 | */ |
||||||
163 | $criteriaUidVideo = new Criteria('uid_owner', $controller->uidOwner); |
||||||
164 | $criteria_featuredvideo = new Criteria('featured_video', '1'); |
||||||
165 | $criteria_video = new CriteriaCompo($criteria_featuredvideo); |
||||||
166 | $criteria_video->add($criteriaUidVideo); |
||||||
167 | if ((isset($nbSections['countVideos']) && $nbSections['countVideos'] > 0) && ($videos = $controller->videosFactory->getObjects($criteria_video))) { |
||||||
168 | $featuredvideocode = $videos[0]->getVar('youtube_code'); |
||||||
169 | $featuredvideotitle = $videos[0]->getVar('video_title'); |
||||||
170 | $featuredvideodesc = $videos[0]->getVar('video_desc'); |
||||||
171 | } |
||||||
172 | /** |
||||||
173 | * Groups |
||||||
174 | */ |
||||||
175 | $criteria_groups = new Criteria('rel_user_uid', $controller->uidOwner); |
||||||
176 | $groups = $controller->relgroupusersFactory->getGroups(8, $criteria_groups); |
||||||
177 | /** |
||||||
178 | * Visitors |
||||||
179 | */ |
||||||
180 | $controller->visitorsFactory->purgeVisits(); |
||||||
181 | if (0 === $controller->isAnonym) { |
||||||
182 | // Fetching last visitors |
||||||
183 | if ($controller->uidOwner !== $xoopsUser->getVar('uid')) { |
||||||
184 | $criteriaDeleteOldVisits = new CriteriaCompo(new Criteria('uid_owner', $controller->uidOwner)); |
||||||
185 | $criteriaDeleteOldVisits->add(new Criteria('uid_visitor', $xoopsUser->getVar('uid'))); |
||||||
186 | $visitorsFactory->deleteAll($criteriaDeleteOldVisits, true); |
||||||
187 | |||||||
188 | $visitor_now = $controller->visitorsFactory->create(); |
||||||
189 | $visitor_now->setVar('uid_owner', $controller->uidOwner); |
||||||
190 | $visitor_now->setVar('uid_visitor', $xoopsUser->getVar('uid')); |
||||||
191 | $visitor_now->setVar('uname_visitor', $xoopsUser->getVar('uname')); |
||||||
192 | $controller->visitorsFactory->insert2($visitor_now); |
||||||
193 | } |
||||||
194 | $criteria_visitors = new Criteria('uid_owner', $controller->uidOwner); |
||||||
195 | //$criteria_visitors->setLimit(5); |
||||||
196 | $visitorsObjectArray = $controller->visitorsFactory->getObjects( |
||||||
197 | $criteria_visitors |
||||||
198 | ); |
||||||
199 | // Lets populate an array with the data from visitors |
||||||
200 | $i = 0; |
||||||
201 | $visitorsArray = []; |
||||||
202 | if (is_array($visitorsObjectArray) && count($visitorsObjectArray) > 0) { |
||||||
203 | foreach ($visitorsObjectArray as $visitor) { |
||||||
204 | $myvisitor = []; |
||||||
205 | if (null !== $visitor) { |
||||||
206 | $myvisitor['uid_visitor'] = $visitor->getVar('uid_visitor', 's'); |
||||||
207 | $myvisitor['uname_visitor'] = $visitor->getVar('uname_visitor', 's'); |
||||||
208 | $myvisitor['date_visited'] = formatTimestamp($visitor->getVar('date_visited'), 'S'); |
||||||
209 | $memberHandler = xoops_getHandler('member'); |
||||||
210 | $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
![]() |
|||||||
211 | $myvisitor['avatar_visitor'] = $visitor->getVar('user_avatar', 's'); |
||||||
212 | $visitorsArray[] = $myvisitor; |
||||||
213 | unset($myvisitor); |
||||||
214 | ++$i; |
||||||
215 | } |
||||||
216 | } |
||||||
217 | } |
||||||
218 | $xoopsTpl->assign('visitors', $visitorsArray); |
||||||
219 | $xoopsTpl->assign('lang_visitors', _MD_SUICO_VISITORS); |
||||||
220 | // $criteria_deletevisitors = new criteria('uid_owner', $uid); |
||||||
221 | // $criteria_deletevisitors->setStart(5); |
||||||
222 | // print_r($criteria_deletevisitors); |
||||||
223 | // $visitorsFactory->deleteAll($criteria_deletevisitors, true); |
||||||
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['countVideos']) && $nbSections['countVideos'] > 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 | ); // We still need to configure the main size in the configs and change the template |
||||||
255 | $xoopsTpl->assign( |
||||||
256 | 'height', |
||||||
257 | $helper->getConfig('height_maintube') |
||||||
258 | ); |
||||||
259 | } |
||||||
260 | /** |
||||||
261 | * Friends |
||||||
262 | */ |
||||||
263 | $friendController = new FriendsController($xoopsDB, $xoopsUser); |
||||||
264 | if ($xoopsUser) { |
||||||
265 | $friendrequest = 0; |
||||||
266 | if (1 === $friendController->isOwner) { |
||||||
267 | $criteria_uidfriendrequest = new Criteria('friendrequestto_uid', $friendController->uidOwner); |
||||||
268 | $newFriendrequest = $friendController->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', $friendController->uidOwner); |
||||||
305 | $friends = $friendController->friendshipsFactory->getFriends(8, $criteria_friends); |
||||||
306 | $xoopsTpl->assign('friends', $friends); |
||||||
307 | $xoopsTpl->assign('lang_friendstitle', sprintf(_MD_SUICO_FRIENDSTITLE, $friendController->nameOwner)); |
||||||
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', ' '); |
||||||
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 | $grouppermHandler = 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 ($grouppermHandler->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'] = htmlspecialchars($results[$i]['title'], ENT_QUOTES | ENT_HTML5); |
||||||
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&mid=' . $mid . '&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 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: