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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
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 | * SmallWorld |
||
14 | * |
||
15 | * @package \XoopsModules\Smallworld |
||
16 | * @license GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/) |
||
17 | * @copyright The XOOPS Project (https://xoops.org) |
||
18 | * @copyright 2011 Culex |
||
19 | * @author Michael Albertsen (http://culex.dk) <[email protected]> |
||
20 | * @link https://github.com/XoopsModules25x/smallworld |
||
21 | * @since 1.0 |
||
22 | */ |
||
23 | |||
24 | use Xmf\Request; |
||
25 | use XoopsModules\Smallworld; |
||
26 | use XoopsModules\Smallworld\Constants; |
||
27 | |||
28 | require_once __DIR__ . '/header.php'; |
||
29 | |||
30 | $GLOBALS['xoopsOption']['template_main'] = 'smallworld_friends_template.tpl'; |
||
31 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
32 | |||
33 | /** @var \XoopsModules\Smallworld\Helper $helper */ |
||
34 | require_once $helper->path('include/functions.php'); |
||
35 | require_once $helper->path('include/arrays.php'); |
||
36 | |||
37 | if ($GLOBALS['xoopsUser'] && ($GLOBALS['xoopsUser'] instanceof \XoopsUser)) { |
||
38 | $check = new Smallworld\User(); |
||
39 | /** @var \XoopsModules\Smallworld\SwUserHandler $swUserHandler */ |
||
40 | $swUserHandler = $helper->getHandler('SwUser'); |
||
41 | $yourid = $GLOBALS['xoopsUser']->uid(); // your uid |
||
42 | $id = $swUserHandler->getByName(Request::getString('username', '', 'GET')); // Id of user which profile you want to see |
||
43 | //$id = smallworld_isset_or(Request::getString('username', '', 'GET')); // Id of user which profile you want to see |
||
44 | $Xuser = new \XoopsUser($id); |
||
45 | $Xusername = $Xuser->getVar('uname'); |
||
46 | //$profile = $check->checkIfProfile($id); |
||
47 | $profile = $swUserHandler->checkIfProfile($id); |
||
48 | $friends = new Smallworld\Friends(); |
||
49 | |||
50 | // Check if inspected userid -> redirect to userprofile and show admin countdown |
||
51 | $inspect = smallworld_isInspected($yourid); |
||
52 | View Code Duplication | if ('yes' === $inspect['inspect']) { |
|
53 | $helper->redirect('userprofile.php?username=' . $GLOBALS['xoopsUser']->getVar('uname'), 1); |
||
54 | } |
||
55 | |||
56 | if ($profile >= Constants::PROFILE_HAS_BOTH) { |
||
57 | $user = new Smallworld\Profile(); |
||
58 | $user->showUser($id); |
||
59 | $username = $GLOBALS['xoopsUser']->getVar('uname'); //Myusername |
||
60 | $tpl_admin = 'NO'; |
||
61 | if ($helper->isUserAdmin()) { |
||
62 | $tpl_admin = 'YES'; |
||
63 | $GLOBALS['xoopsTpl']->assign('ownerofpage', $id); |
||
64 | } |
||
65 | $GLOBALS['xoopsTpl']->assign('isadminuser', $tpl_admin); |
||
66 | |||
67 | // Check status for relationship |
||
68 | $fr = $check->friendcheck($yourid, $id); |
||
69 | $tpl_friend = $helper->isUserAdmin() ? 'yes' : 'no'; |
||
70 | switch ($fr[0]) { |
||
71 | case 0: |
||
72 | $friendship_text = _SMALLWORLD_JSON_ADDFR_TEXT; |
||
73 | $GLOBALS['xoopsTpl']->assign('isuserafriend', $tpl_friend); |
||
74 | break; |
||
75 | case 1: |
||
76 | $friendship_text = _SMALLWORLD_JSON_CANCELFR_TEXT; |
||
77 | $GLOBALS['xoopsTpl']->assign('isuserafriend', $tpl_friend); |
||
78 | break; |
||
79 | case 2: |
||
80 | $friendship_text = _SMALLWORLD_JSON_REMOVEFR_TEXT; |
||
81 | $GLOBALS['xoopsTpl']->assign('isuserafriend', 'yes'); |
||
82 | break; |
||
83 | default: |
||
84 | //@todo - figure out what to do here if it ever happens |
||
85 | } |
||
86 | |||
87 | // Check status for follow |
||
88 | if ($yourid == $id) { |
||
89 | $following_text = _SMALLWORLD_JSON_FLYES_TEXT; |
||
90 | } else { |
||
91 | $fl = $check->following_or($yourid, $id); |
||
92 | $following_text = (1 == $fl[0]) ? _SMALLWORLD_JSON_FLNO_TEXT : _SMALLWORLD_JSON_FLYES_TEXT; |
||
93 | } |
||
94 | |||
95 | // Get requests |
||
96 | $getInvitations = $check->getRequests($yourid); |
||
97 | |||
98 | // Things to do with wall |
||
99 | $wall = new Smallworld\WallUpdates(); |
||
100 | $myavatar = $swUserHandler->gravatar($id); |
||
101 | $myavatarlink = $swUserHandler->getAvatarLink($id, $myavatar); |
||
102 | |||
103 | // Get your followers array |
||
104 | $followers = $wall->getFollowers($id); |
||
105 | |||
106 | // Pendings array here |
||
107 | $pending_array = $friends->getFriends($id, 'pending'); |
||
108 | |||
109 | // Friends array here |
||
110 | $friends_array = $friends->getFriends($id, 'friends'); |
||
111 | |||
112 | // Pendings array here |
||
113 | $following_array = $friends->getFriends($id, 'following'); |
||
114 | |||
115 | // Users Following you |
||
116 | $followingme_array = $friends->getFriends($id, 'followingme'); |
||
117 | |||
118 | //Srinivas Tamada http://9lessons.info |
||
119 | //Loading Comments link with load_updates.php |
||
120 | View Code Duplication | foreach ($pending_array as $data) { |
|
121 | $fp['friend_id'] = $data['you']; |
||
122 | $fp['friendname'] = $swUserHandler->getName($data['you']); |
||
123 | $fp['avatar'] = $swUserHandler->gravatar($data['you']); |
||
124 | $fp['avatar_link'] = $swUserHandler->getAvatarLink($data['you'], $fp['avatar']); |
||
125 | $fp['avatar_size'] = smallworld_getImageSize(80, 100, $fp['avatar_link']); |
||
126 | $fp['avatar_highwide'] = smallworld_imageResize($fp['avatar_size'][0], $fp['avatar_size'][1], 50); |
||
127 | $GLOBALS['xoopsTpl']->append('pendingfriends', $fp); |
||
128 | } |
||
129 | |||
130 | View Code Duplication | foreach ($friends_array as $data) { |
|
131 | $ff['friend_id'] = $data['you']; |
||
132 | $ff['friendname'] = $swUserHandler->getName($data['you']); |
||
133 | $ff['avatar'] = $swUserHandler->gravatar($data['you']); |
||
134 | $ff['avatar_link'] = $swUserHandler->getAvatarLink($data['you'], $ff['avatar']); |
||
135 | $ff['avatar_size'] = smallworld_getImageSize(80, 100, $ff['avatar_link']); |
||
136 | $ff['avatar_highwide'] = smallworld_imageResize($ff['avatar_size'][0], $ff['avatar_size'][1], 50); |
||
137 | $GLOBALS['xoopsTpl']->append('verifiedfriends', $ff); |
||
138 | } |
||
139 | |||
140 | View Code Duplication | foreach ($following_array as $data) { |
|
141 | $fy['friend_id'] = $data['you']; |
||
142 | $fy['friendname'] = $swUserHandler->getName($data['you']); |
||
143 | $fy['avatar'] = $swUserHandler->gravatar($data['you']); |
||
144 | $fy['avatar_link'] = $swUserHandler->getAvatarLink($data['you'], $fy['avatar']); |
||
145 | $fy['avatar_size'] = smallworld_getImageSize(80, 100, $fy['avatar_link']); |
||
146 | $fy['avatar_highwide'] = smallworld_imageResize($fy['avatar_size'][0], $fy['avatar_size'][1], 50); |
||
147 | $GLOBALS['xoopsTpl']->append('followingyou', $fy); |
||
148 | } |
||
149 | |||
150 | View Code Duplication | foreach ($followingme_array as $data) { |
|
151 | $fm['friend_id'] = $data['me']; |
||
152 | $fm['friendname'] = $swUserHandler->getName($data['me']); |
||
153 | $fm['avatar'] = $swUserHandler->gravatar($data['me']); |
||
154 | $fm['avatar_link'] = $swUserHandler->getAvatarLink($data['me'], $fm['avatar']); |
||
155 | $fm['avatar_size'] = smallworld_getImageSize(80, 100, $fm['avatar_link']); |
||
156 | $fm['avatar_highwide'] = smallworld_imageResize($fm['avatar_size'][0], $fm['avatar_size'][1], 50); |
||
157 | $GLOBALS['xoopsTpl']->append('followingme', $fm); |
||
158 | } |
||
159 | |||
160 | // Create form for private settings |
||
161 | $form = new Smallworld\Form(); |
||
162 | $usersettings = $form->usersettings($yourid, $selected = null); |
||
0 ignored issues
–
show
|
|||
163 | $GLOBALS['xoopsTpl']->assign('usersetting', $usersettings); |
||
164 | |||
165 | // Get usermenu to template |
||
166 | $menu_home = "<a href='" . $helper->url('index.php') . "'><img id='menuimg' src='" . $helper->url('assets/images/house.png') . "'>" . _SMALLWORLD_HOME . '</a>'; |
||
167 | $menu_profile = "<a href='" . $helper->url('userprofile.php?username=' . $Xusername) . "'><img id='menuimg' src='" . $helper->url('assets/images/user_silhouette.png') . "'>" . _SMALLWORLD_PROFILEINDEX . '</a>'; |
||
168 | $menu_gallery = "<a href='" . $helper->url('galleryshow.php?username=' . $Xusername) . "'><img id='menuimg' src='" . $helper->url('assets/images/picture.png') . "'>" . _SMALLWORLD_GALLERY . '</a>'; |
||
169 | $menu_friends = "<a href='" . $helper->url('friends.php?username=' . $Xusername) . "'><img id='menuimg' src='" . $helper->url('assets/images/group.png') . "'>" . _SMALLWORLD_FRIENDSPAGE . '</a>'; |
||
170 | $menu_xim_js = "javascript:chatWith('" . $id . "','" . $Xusername . "')"; |
||
171 | $menu_ximme = "<a href='javascript:void(0);' onClick=" . $menu_xim_js . "><img height='10px' width='10px' src='" . $helper->url('assets/images/messenger.png') . "'>" . _SMALLWORLD_XIMUSER . $Xusername . '</a>'; |
||
172 | |||
173 | // Check for folder xim to add messenger user to menu items |
||
174 | $hasxim = smallworld_checkForXim(); |
||
175 | if (true === $hasxim) { |
||
176 | $GLOBALS['xoopsTpl']->assign('sendxim', 'YES'); |
||
177 | View Code Duplication | if (2 == $fr[0]) { |
|
178 | if ($yourid != $id) { |
||
179 | $GLOBALS['xoopsTpl']->assign('menu_xim', $menu_ximme); |
||
180 | } |
||
181 | } |
||
182 | } |
||
183 | |||
184 | $GLOBALS['xoopsTpl']->assign([ |
||
185 | 'menu_home' => $menu_home, |
||
186 | 'menu_profile' => $menu_profile, |
||
187 | 'menu_friends' => $menu_friends, |
||
188 | 'menu_gallery' => $menu_gallery, |
||
189 | 'check' => $profile, |
||
190 | 'friendID' => $id, |
||
191 | 'myUid' => $yourid, |
||
192 | 'friendship_text' => $friendship_text, |
||
193 | 'followfriend_text' => $following_text, |
||
194 | 'friendinvitations' => $getInvitations, |
||
195 | 'myavatar' => $myavatar, |
||
196 | 'myavatarlink' => $myavatarlink, |
||
197 | 'myusername' => $username, |
||
198 | 'username' => $Xusername, |
||
199 | 'nouserspending' => _SMALLWORLD_NOUSERS, |
||
200 | 'nousersfriends' => _SMALLWORLD_NOUSERS, |
||
201 | 'nousersfollowingyou' => _SMALLWORLD_NOUSERS, |
||
202 | 'nousersfollowingme' => _SMALLWORLD_NOUSERS |
||
203 | ]); |
||
204 | } else { |
||
205 | $check->chkUser(); |
||
206 | } |
||
207 | } else { |
||
208 | redirect_header(XOOPS_URL . '/user.php', Constants::REDIRECT_DELAY_SHORT, _NOPERM); |
||
209 | } |
||
210 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
211 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.