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_userprofile_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 | $GLOBALS['xoopsLogger']->activated = false; |
||
38 | //error_reporting(E_ALL); |
||
39 | |||
40 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
||
0 ignored issues
–
show
|
|||
41 | SmallworldDeleteOldInspects(); |
||
42 | $swUserHandler = $helper->getHandler('SwUser'); |
||
43 | $username = Request::getString('username', '', 'GET'); |
||
44 | $id = $swUserHandler->getByName(addslashes($username)); |
||
45 | //$id = smallworld_isset_or(addslashes(Request::getString('username', '', 'GET'))); // Id of user which profile you want to see |
||
46 | //$id = (int)$id; |
||
47 | $yourid = $GLOBALS['xoopsUser']->uid(); // this user's uid |
||
48 | $Xuser = new \XoopsUser($id); |
||
49 | $Xusername = (($Xuser instanceof \XoopsUser) && !$Xuser->isNew() && !$Xuser->isGuest()) ? $Xuser->getVar('uname') : ''; |
||
50 | $check = new Smallworld\User(); |
||
51 | $profile = $swUserHandler->checkIfProfile($yourid); |
||
52 | $userNumMsg = smallworld_countUserWallMsges($id); |
||
53 | $fr[0] = ''; |
||
54 | $fl[0] = ''; |
||
55 | |||
56 | $GLOBALS['xoopsTpl']->assign('isadminuser', $helper->isUserAdmin() ? 'YES' : 'NO'); |
||
57 | |||
58 | if ($profile >= Constants::PROFILE_HAS_BOTH) { |
||
59 | $user = new Smallworld\Profile(); |
||
60 | //$swDB = new Smallworld\SwDatabase(); |
||
61 | $user->showUser($id); |
||
62 | $username = $GLOBALS['xoopsUser']->getVar('uname'); //Myusername |
||
63 | $inspected = smallworld_isInspected($id); |
||
64 | $GLOBALS['xoopsTpl']->assign('inspect', $inspected['inspect']); |
||
65 | if ('no' !== $inspected['inspect']) { |
||
66 | $GLOBALS['xoopsTpl']->assign('inspecttime', $inspected['totaltime']); |
||
67 | } |
||
68 | $GLOBALS['xoopsTpl']->assign('ownerofpage', $id); |
||
69 | |||
70 | // Check status for relationship |
||
71 | $fr = $check->friendcheck($yourid, $id); |
||
72 | switch ($fr[0]) { |
||
73 | View Code Duplication | case 0: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
74 | $friendship_text = _SMALLWORLD_JSON_ADDFR_TEXT; |
||
75 | $GLOBALS['xoopsTpl']->assign('isuserafriend', $helper->isUserAdmin() ? 'yes' : 'no'); |
||
76 | break; |
||
77 | View Code Duplication | case 1: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
78 | $friendship_text = _SMALLWORLD_JSON_CANCELFR_TEXT; |
||
79 | $GLOBALS['xoopsTpl']->assign('isuserafriend', $helper->isUserAdmin() ? 'yes' : 'no'); |
||
80 | break; |
||
81 | case 2: |
||
82 | $friendship_text = _SMALLWORLD_JSON_REMOVEFR_TEXT; |
||
83 | $GLOBALS['xoopsTpl']->assign('isuserafriend', 'yes'); |
||
84 | break; |
||
85 | default: |
||
86 | $friendship_text = ''; |
||
87 | $GLOBALS['xoopsTpl']->assign('isuserafriend', 'no'); |
||
88 | break; |
||
89 | } |
||
90 | |||
91 | // Check status for follow |
||
92 | $fl = $check->following_or($yourid, $id); |
||
93 | if ($yourid == $id || (0 == $fl[0])) { |
||
94 | $following_text = _SMALLWORLD_JSON_FLYES_TEXT; |
||
95 | } elseif (1 == $fl[0]) { |
||
96 | $following_text = _SMALLWORLD_JSON_FLNO_TEXT; |
||
97 | } |
||
98 | |||
99 | // Get requests |
||
100 | $getInvitations = $check->getRequests($yourid); |
||
101 | |||
102 | // Things to do with wall |
||
103 | $wall = new Smallworld\WallUpdates(); |
||
104 | |||
105 | $visitorAvatar = $swUserHandler->gravatar($yourid); |
||
106 | $visitorAvatarlink = $swUserHandler->getAvatarLink($yourid, $visitorAvatar); |
||
107 | $visitorAvatar_size = smallworld_getImageSize(80, 100, $visitorAvatarlink); |
||
108 | $visitorAvatar_highwide = smallworld_imageResize($visitorAvatar_size[0], $visitorAvatar_size[1], 35); |
||
109 | |||
110 | // Follow array here |
||
111 | $followers = $wall->getFollowers($id); |
||
112 | $updatesarray = $wall->Updates(0, $id, $followers); |
||
113 | $wall->parsePubArray($updatesarray, $id); |
||
114 | |||
115 | // Create form for private settings |
||
116 | $form = new Smallworld\Form(); |
||
117 | $usersettings = $form->usersettings($yourid, $selected = null); |
||
118 | $GLOBALS['xoopsTpl']->assign('usersetting', $usersettings); |
||
119 | |||
120 | // Get usermenu to template |
||
121 | $menu_startpage = "<a href='" . $helper->url('publicindex.php') . "'><img id='menuimg' src='" . $helper->url('assets/images/highrise.png') . "'>" . _SMALLWORLD_STARTPAGE . '</a>'; |
||
122 | $menu_home = "<a href='" . $helper->url('/') . "'><img id='menuimg' src='" . $helper->url('assets/images/house.png') . "'>" . _SMALLWORLD_HOME . '</a>'; |
||
123 | $menu_profile = "<a href='" . $helper->url('userprofile.php?username=' . $Xusername) . "'><img id='menuimg' src='" . $helper->url('assets/images/user_silhouette.png') . "'>" . _SMALLWORLD_PROFILEINDEX . '</a>'; |
||
124 | $menu_gallery = "<a href='" . $helper->url('galleryshow.php?username=' . $Xusername) . "'><img id='menuimg' src='" . $helper->url('assets/images/picture.png') . "'>" . _SMALLWORLD_GALLERY . '</a>'; |
||
125 | $menu_friends = "<a href='" . $helper->url('friends.php?username=' . $Xusername) . "'><img id='menuimg' src='" . $helper->url('assets/images/group.png') . "'>" . _SMALLWORLD_FRIENDSPAGE . '</a>'; |
||
126 | |||
127 | // Xim Module Inclusion |
||
128 | if ($xim_helper = $helper->getHelper('xim')) { // checks for existance and if module is active |
||
129 | if ($xim_helper->getModule()->version() > 102) { //load appropriate js based on XIM version |
||
130 | $menu_xim_js = "javascript:xim_chatWith('" . $id . "','" . $Xusername . "')"; |
||
131 | } else { |
||
132 | $menu_xim_js = "javascript:chatWith('" . $id . "','" . $Xusername . "')"; |
||
133 | } |
||
134 | |||
135 | $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>'; |
||
136 | |||
137 | $GLOBALS['xoopsTpl']->assign('sendxim', 'YES'); |
||
138 | View Code Duplication | if (2 == $fr[0] && ($yourid !== $id)) { |
|
139 | $GLOBALS['xoopsTpl']->assign('menu_xim', $menu_ximme); |
||
140 | } |
||
141 | } |
||
142 | |||
143 | $birthday_today_text = "<img width='20px' height='20px' src='" . $helper->url('assets/images/bdayballoons_l.png') . "'>" . ' ' . _SMALLWORLD_BDAY_TODAY . ' ' . "<img width='20px' height='20px' src='" . $helper->url('assets/images/bdayballoons_r.png') . "'>"; |
||
144 | |||
145 | $GLOBALS['xoopsTpl']->assign( |
||
146 | [ |
||
147 | 'menu_startpage' => $menu_startpage, |
||
148 | 'menu_home' => $menu_home, |
||
149 | 'menu_profile' => $menu_profile, |
||
150 | 'menu_friends' => $menu_friends, |
||
151 | 'menu_gallery' => $menu_gallery, |
||
152 | 'check' => $profile, |
||
153 | 'friendID' => $id, |
||
154 | 'myUid' => $yourid, |
||
155 | 'friendship_text' => $friendship_text, |
||
156 | 'followfriend_text' => $following_text, |
||
157 | 'friendinvitations' => $getInvitations, |
||
158 | 'visitoravatar' => $visitorAvatar, |
||
159 | 'visitoravatarlink' => $visitorAvatarlink, |
||
160 | 'visitoravatar_highwide' => $visitorAvatar_highwide, |
||
161 | 'myusername' => $username, |
||
162 | 'username' => $Xusername, |
||
163 | 'bdaynow' => $birthday_today_text, |
||
164 | 'isfollowing' => $fl[0], |
||
165 | 'flds' => $helper->getConfig('smallworldusethesefields'), |
||
166 | 'userNumMsg' => $userNumMsg, |
||
167 | ] |
||
168 | ); |
||
169 | } |
||
170 | |||
171 | if ($profile < Constants::PROFILE_HAS_BOTH) { |
||
172 | $helper->redirect('index.php'); |
||
173 | } |
||
174 | //Check Language |
||
175 | $lang = $GLOBALS['xoopsConfig']['language']; |
||
176 | |||
177 | // GET various variables from language folder |
||
178 | if (file_exists($helper->path("language/{$lang}/js/jquery.countdown.js"))) { |
||
179 | $GLOBALS['xoTheme']->addScript($helper->url("language/{$lang}/js/jquery.countdown.js")); |
||
180 | } else { |
||
181 | $GLOBALS['xoTheme']->addScript($helper->url('language/english/js/jquery.countdown.js')); |
||
182 | } |
||
183 | } else { |
||
184 | //redirect_header(XOOPS_URL . '/user.php', Constants::REDIRECT_DELAY_MEDIUM, _NOPERM); |
||
185 | } |
||
186 | |||
187 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
188 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.