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 XoopsModules\Smallworld; |
||
25 | use XoopsModules\Smallworld\Constants; |
||
26 | |||
27 | require_once __DIR__ . '/header.php'; |
||
28 | |||
29 | /** @var \XoopsModules\Smallworld\Helper $helper */ |
||
30 | require_once $helper->path('include/functions.php'); |
||
31 | require_once $helper->path('include/arrays.php'); |
||
32 | |||
33 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
||
0 ignored issues
–
show
|
|||
34 | $GLOBALS['xoopsOption']['template_main'] = 'smallworld_index.tpl'; |
||
35 | } elseif (((!$GLOBALS['xoopsUser'] instanceof \XoopsUser)) || Constants::HAS_ACCESS == $set['access']) { |
||
0 ignored issues
–
show
The class
XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
36 | $GLOBALS['xoopsOption']['template_main'] = 'smallworld_publicindex.tpl'; |
||
37 | } else { |
||
38 | redirect_header(XOOPS_URL . '/user.php', Constants::REDIRECT_DELAY_MEDIUM, _NOPERM); |
||
39 | } |
||
40 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
41 | |||
42 | $set = smallworld_checkPrivateOrPublic(); |
||
43 | |||
44 | if (Constants::HAS_ACCESS == $set['access']) { |
||
45 | $id = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->uid() : Constants::DEFAULT_UID; |
||
0 ignored issues
–
show
The class
XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
46 | $user = new \XoopsUser($id); //creates Guest XOOPS user if not current XOOPS user |
||
47 | |||
48 | // Check if inspected userid -> redirect to userprofile and show admin countdown |
||
49 | $inspect = smallworld_isInspected($id); |
||
50 | View Code Duplication | if ('yes' === $inspect['inspect']) { |
|
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. ![]() |
|||
51 | $helper->redirect('userprofile.php?username=' . $GLOBALS['xoopsUser']->getVar('uname'), Constants::REDIRECT_DELAY_NONE); |
||
52 | } |
||
53 | |||
54 | $GLOBALS['xoopsTpl']->assign('ownerofpage', $id); |
||
55 | $GLOBALS['xoopsTpl']->assign('isadminuser', ($helper->isUserAdmin() ? 'YES' : 'NO')); |
||
56 | |||
57 | // Create form for private settings |
||
58 | $form = new Smallworld\Form(); |
||
59 | //$usersettings = $form->usersettings($id, $selected = null); |
||
60 | $GLOBALS['xoopsTpl']->assign('usersetting', $form->usersettings($id)); |
||
61 | $username = $user->uname(); |
||
62 | $profile = $helper->getHandler('SwUser')->checkIfProfile($id); |
||
63 | if (Constants::PROFILE_HAS_BOTH <= $profile) { |
||
64 | $profileObj = new Smallworld\Profile(); |
||
65 | $profileObj->showUser($id); |
||
66 | $menu_startpage = "<a href='" . $helper->url('publicindex.php') . "'><img id='menuimg' src='" . $helper->url('assets/images/highrise.png') . "'>" . _SMALLWORLD_STARTPAGE . '</a>'; |
||
67 | $menu_home = "<a href='" . $helper->url('index.php') . "'><img id='menuimg' src='" . $helper->url('assets/images/house.png') . "'>" . _SMALLWORLD_HOME . '</a>'; |
||
68 | $menu_profile = "<a href='" . $helper->url('userprofile.php?username=' . $username) . "'><img id='menuimg' src='" . $helper->url('assets/images/user_silhouette.png') . "'>" . _SMALLWORLD_PROFILEINDEX . '</a>'; |
||
69 | $menu_gallery = "<a href='" . $helper->url('galleryshow.php?username=' . $username) . "'><img id='menuimg' src='" . $helper->url('assets/images/picture.png') . "'>" . _SMALLWORLD_GALLERY . '</a>'; |
||
70 | $menu_friends = "<a href='" . $helper->url('friends.php?username=' . $username) . "'><img id='menuimg' src='" . $helper->url('assets/images/group.png') . "'>" . _SMALLWORLD_FRIENDSPAGE . '</a>'; |
||
71 | $wall = new Smallworld\WallUpdates(); |
||
72 | // Follow array here |
||
73 | $followers = smallworld_array_flatten($wall->getFollowers($id), 0); |
||
74 | $updatesarray = $wall->Updates(0, $id, $followers); |
||
75 | $GLOBALS['xoopsTpl']->assign( |
||
76 | [ |
||
77 | 'menu_startpage' => $menu_startpage, |
||
78 | 'menu_home' => $menu_home, |
||
79 | 'menu_profile' => $menu_profile, |
||
80 | 'menu_friends' => $menu_friends, |
||
81 | 'menu_gallery' => $menu_gallery, |
||
82 | ] |
||
83 | ); |
||
84 | } else { |
||
85 | $wall = new Smallworld\PublicWallUpdates(); |
||
86 | $pub = smallworld_checkUserPubPostPerm(); |
||
87 | $updatesarray = $wall->Updates(0, $pub); |
||
0 ignored issues
–
show
It seems like
$pub defined by smallworld_checkUserPubPostPerm() on line 86 can also be of type string ; however, XoopsModules\Smallworld\...cWallUpdates::Updates() does only seem to accept array , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() |
|||
88 | } |
||
89 | |||
90 | //Get friends invitations |
||
91 | $check = new Smallworld\User(); |
||
92 | $getInvitations = $GLOBALS['xoopsUser'] ? $check->getRequests($id) : 0; |
||
93 | $wall->parsePubArray($updatesarray, $id); |
||
0 ignored issues
–
show
It seems like
$updatesarray defined by $wall->Updates(0, $pub) on line 87 can also be of type boolean ; however, XoopsModules\Smallworld\...pdates::parsePubArray() does only seem to accept array , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() It seems like
$updatesarray defined by $wall->Updates(0, $pub) on line 87 can also be of type boolean ; however, XoopsModules\Smallworld\...pdates::parsePubArray() does only seem to accept array , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() |
|||
94 | $GLOBALS['xoopsTpl']->assign( |
||
95 | [ |
||
96 | 'myusername' => $username, |
||
97 | 'pagename' => 'index', |
||
98 | 'check' => $profile, |
||
99 | 'friendinvitations' => $getInvitations, |
||
100 | 'access' => $set['access'], |
||
101 | ] |
||
102 | ); |
||
103 | } |
||
104 | if (Constants::PROFILE_XOOPS_ONLY == $profile && Constants::NO_ACCESS == $set['access']) { |
||
105 | $helper->redirect('register.php'); |
||
106 | } |
||
107 | |||
108 | // if ($profile == Constants::PROFILE_XOOPS_ONLY && $set['access'] <= Constants::HAS_ACCESS) { |
||
109 | // $helper->redirect('register.php'); |
||
110 | // } |
||
111 | |||
112 | //if (Constants::PROFILE_NONE == $profile && Constants::NO_ACCESS == $set['access']) { |
||
113 | // redirect_header(XOOPS_URL . "/user.php", Constants::REDIRECT_DELAY_MEDIUM, _NOPERM); |
||
114 | //} |
||
115 | |||
116 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
117 |
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.