Issues (67)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.
Severity
1
<?php declare(strict_types=1);
2
3
/**
4
 * Xoops Members Module
5
 *
6
 * You may not change or alter any portion of this comment or credits
7
 * of supporting developers from this source code or any supporting source code
8
 * which is considered copyrighted (c) material of the original comment or credit authors.
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
 * @copyright XOOPS Project (https://xoops.org)
14
 * @license   https://www.fsf.org/copyleft/gpl.html GNU public license
15
 * @since     2.3.0
16
 * @author    onokazu
17
 * @author    John Neill
18
 */
19
20
use Xmf\Request;
21
22
$GLOBALS['xoopsOption']['template_main'] = 'xoopsmembers_index.tpl';
23
require_once __DIR__ . '/header.php';
24
25
//global $pathIcon16;
26
27
global $xoopsModule;
28
29
if ('datatables1' == $xoopsModuleConfig['indextemplate'] || 'datatables2' == $xoopsModuleConfig['indextemplate'] || 'datatables3' == $xoopsModuleConfig['indextemplate']) {
30
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/jquery.dataTables.css');
31
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/responsive.dataTables.min.css');
32
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/jquery.dataTables.js');
33
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/dataTables.responsive.min.js');
34
}
35
if ('datatables3' == $xoopsModuleConfig['indextemplate']) {
36
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/dataTables.alphabetSearch.css');
37
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/dataTables.alphabetSearch.js');
38
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/jquery.dataTables.css');
39
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/responsive.dataTables.min.css');
40
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/jquery.dataTables.js');
41
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/dataTables.responsive.min.js');
42
}
43
44
/** @var \XoopsMemberHandler $memberHandler */
45
$memberHandler = xoops_getHandler('member');
46
$total         = $memberHandler->getUserCount(new \Criteria('level', 0, '>'));
47
48
$iamadmin = $xoopsUserIsAdmin;
49
$myts     = \MyTextSanitizer::getInstance();
50
$criteria = new \CriteriaCompo();
51
52
$criteria->add(new \Criteria('level', 0, '>'));
53
$validsort = ['uname', 'name', 'last_login', 'user_regdate', 'posts'];
54
//$sort      = (!in_array($helper->getModule()->getInfo('sortmembers'), $validsort)) ? 'uname' : $helper->getModule()->getInfo('sortmembers');
55
//temp solution
56
$sort = (!in_array($xoopsModuleConfig['sortmembers'], $validsort, true)) ? 'uname' : $xoopsModuleConfig['sortmembers'];
57
58
$order = 'ASC';
59
//$temp  = $helper->getModule()->getInfo('membersorder');
60
//temp solution
61
if (isset($xoopsModuleConfig['membersorder']) && $xoopsModuleConfig['membersorder'] == 'DESC') {
62
    //if (isset($temp) && 'DESC' == $temp) {
63
    $order = 'DESC';
64
}
65
66
if ('normal' == $xoopsModuleConfig['indextemplate']) {
67
    //temp solution
68
    $limit = (!empty($xoopsModuleConfig['membersperpage'])) ? intval($xoopsModuleConfig['membersperpage']) : 20;
69
    //$limit = \Xmf\Request::getInt('limit', 20, 'POST');
70
    if (0 == $limit || $limit > 50) {
71
        $limit = 50;
72
    }
73
}
74
$start = Request::getInt('start', 0, 'POST');
75
$total = $memberHandler->getUserCount($criteria);
76
$xoopsTpl->assign('totalmember', $total);
77
78
//Show last member
79
$result = $GLOBALS['xoopsDB']->query('SELECT uid, uname FROM ' . $GLOBALS['xoopsDB']->prefix('users') . ' WHERE level > 0 ORDER BY uid DESC', 1, 0);
80
[$latestuid, $latestuser] = $GLOBALS['xoopsDB']->fetchRow($result);
81
$xoopsTpl->assign('latestmember', " <a href='" . XOOPS_URL . '/userinfo.php?uid=' . $latestuid . "'>" . $latestuser . '</a>');
82
$xoopsTpl->assign('welcomemessage', $xoopsModuleConfig['welcomemessage']);
83
84
if (0 == $total) {
85
} elseif ($start < $total) {
86
    if ($iamadmin) {
87
        $xoopsTpl->assign('is_admin', true);
88
    }
89
    $criteria->setSort($sort);
90
    $criteria->setOrder($order);
91
    $criteria->setStart($start);
92
    if ('normal' == $xoopsModuleConfig['indextemplate']) {
93
        $criteria->setLimit($limit);
94
    }
95
    $foundusers = $memberHandler->getUsers($criteria, true);
96
    foreach (array_keys($foundusers) as $j) {
97
        $userdata['avatar']   = $foundusers[$j]->getVar('user_avatar');
98
        $userdata['realname'] = $foundusers[$j]->getVar('name');
99
        $userdata['name']     = $foundusers[$j]->getVar('uname');
100
        $userdata['id']       = $foundusers[$j]->getVar('uid');
101
        if (1 == $foundusers[$j]->getVar('user_viewemail') || $iamadmin) {
102
            $userdata['email']        = '<a href="mailto:' . $foundusers[$j]->getVar('email') . '"><img src="' . XOOPS_URL . '/images/icons/email.gif" border="0" alt="' . sprintf(_SENDEMAILTO, $foundusers[$j]->getVar('uname', 'e')) . '"></a>';
103
            $userdata['emailaddress'] = $foundusers[$j]->getVar('email');
104
        }
105
        if ($xoopsUser) {
106
            $userdata['pmlink'] = '<a href="javascript:openWithSelfMain(\'' . XOOPS_URL . '/pmlite.php?send2=1&amp;to_userid=' . $foundusers[$j]->getVar('uid') . '\',\'pmlite\',450,370);"><img src="' . XOOPS_URL . '/images/icons/pm.gif" border="0" alt="' . sprintf(
107
                    _SENDPMTO,
108
                    $foundusers[$j]->getVar(
109
                        'uname',
110
                        'e'
111
                    )
112
                ) . '"></a>';
113
            $userdata['pm']     = $foundusers[$j]->getVar('uid');
114
        }
115
        if ('' != $foundusers[$j]->getVar('url', 'e')) {
116
            $userdata['website'] = '<a href="' . $foundusers[$j]->getVar('url', 'e') . '" target="_blank"><img src="' . XOOPS_URL . '/images/icons/www.gif" border="0" alt="' . _VISITWEBSITE . '"></a>';
117
        }
118
        $userdata['url']          = $foundusers[$j]->getVar('url', 'e');
119
        $userdata['registerdate'] = formatTimestamp($foundusers[$j]->getVar('user_regdate'), 's');
120
        if (0 != $foundusers[$j]->getVar('last_login')) {
121
            $userdata['lastlogin'] = formatTimestamp($foundusers[$j]->getVar('last_login'), 'm');
122
        } else {
123
            $userdata['lastlogin'] = _MD_XOOPSMEMBERS_NEVERLOGIN;
124
        }
125
        $userdata['posts'] = $foundusers[$j]->getVar('posts');
126
        if ($iamadmin) {
127
            $userdata['adminlink'] = '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=users&amp;uid=' . $foundusers[$j]->getVar('uid') . '&amp;op=users_edit">' . '<img src=' . $pathIcon16 . '/edit.png' . " alt='" . _EDIT . "' title='" . _EDIT . "'>"
128
129
                                     . '</a> <a href="' . XOOPS_URL . '/modules/system/admin.php?fct=users&amp;op=users_delete&amp;uid=' . $foundusers[$j]->getVar('uid') . '">' . '<img src=' . $pathIcon16 . '/delete.png' . " alt='" . _DELETE . "' title='" . _DELETE . "'>" . '</a>';
130
        }
131
132
        $userdata['location']     = $foundusers[$j]->getVar('user_from');
133
        $userdata['occupation']   = $foundusers[$j]->getVar('user_occ');
134
        $userdata['interest']     = $foundusers[$j]->getVar('user_intrest');
135
        $userdata['extrainfo']    = $foundusers[$j]->getVar('bio');
136
        $userdata['signature']    = $foundusers[$j]->getVar('user_sig');
137
        $userdata['onlinestatus'] = $foundusers[$j]->isOnline();
138
        $userrank                 = $foundusers[$j]->rank();
139
        if ($userrank['image']) {
140
            $userdata['rankimage'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="">';
141
        }
142
        $userdata['ranktitle'] = $userrank['title'];
143
144
        $uid        = $userdata['id'];
145
        $groups     = $memberHandler->getGroupsByUser($uid, true);
146
        $usergroups = [];
147
        foreach ($groups as $group) {
148
            $usergroups[] = $group->getVar('name');
149
        }
150
        $userdata['groups'] = implode(', ', $usergroups);
151
152
        $xoopsTpl->append('users', $userdata);
153
    }
154
    if ('normal' == $xoopsModuleConfig['indextemplate']) {
155
        $totalpages = ceil($total / $limit);
156
        if ($totalpages > 1) {
157
            $hiddenform = '<form name="findnext" action="index.php" method="post">';
158
            foreach ($_POST as $k => $v) {
159
                $hiddenform .= '<input type="hidden" name="' . htmlspecialchars($k) . '" value="' . $myts->previewTarea($v) . '">';
160
            }
161
            if (!isset($_POST['limit'])) {
162
                $hiddenform .= '<input type="hidden" name="limit" value="' . $limit . '">';
163
            }
164
            if (!isset($_POST['start'])) {
165
                $hiddenform .= '<input type="hidden" name="start" value="' . $start . '">';
166
            }
167
            $prev = $start - $limit;
168
            if ($start - $limit >= 0) {
169
                $hiddenform .= '<a href="#0" onclick="javascript:document.findnext.start.value=' . $prev . ';document.findnext.submit();">' . _MD_XOOPSMEMBERS_PREVIOUS . '</a>&nbsp;';
170
            }
171
            $counter     = 1;
172
            $currentpage = ($start + $limit) / $limit;
173
            while ($counter <= $totalpages) {
174
                if ($counter == $currentpage) {
175
                    $hiddenform .= '<b>' . $counter . '</b> ';
176
                } elseif (($counter > $currentpage - 4 && $counter < $currentpage + 4) || 1 == $counter || $counter == $totalpages) {
177
                    if ($counter == $totalpages && $currentpage < $totalpages - 4) {
178
                        $hiddenform .= '... ';
179
                    }
180
                    $hiddenform .= '<a href="#' . $counter . '" onclick="javascript:document.findnext.start.value=' . ($counter - 1) * $limit . ';document.findnext.submit();">' . $counter . '</a> ';
181
                    if (1 == $counter && $currentpage > 5) {
182
                        $hiddenform .= '... ';
183
                    }
184
                }
185
                $counter++;
186
            }
187
            $next = $start + $limit;
188
            if ($total > $next) {
189
                $hiddenform .= '&nbsp;<a href="#' . $total . '" onclick="javascript:document.findnext.start.value=' . $next . ';document.findnext.submit();">' . _MD_XOOPSMEMBERS_NEXT . '</a>';
190
            }
191
            $hiddenform .= '</form>';
192
            $xoopsTpl->assign('pagenav', $hiddenform);
193
            $xoopsTpl->assign('lang_numfound', sprintf(_MD_XOOPSMEMBERS_USERSFOUND, $total));
194
        }
195
    }
196
}
197
198
require __DIR__ . '/footer.php';
199
require_once XOOPS_ROOT_PATH . '/footer.php';
200
exit();
201
202
/**
203
 * xoops_Criteria()
204
 *
205
 * @param \CriteriaCompo $criteria
206
 * @param string         $name
207
 * @param string         $ret
208
 * @param string         $match
209
 * @return void
210
 */
211
function xoops_Criteria(&$criteria, $name = '', $ret = '', $match = ''): void
0 ignored issues
show
The parameter $criteria is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

211
function xoops_Criteria(/** @scrutinizer ignore-unused */ &$criteria, $name = '', $ret = '', $match = ''): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
212
{
213
    global $criteria;
214
215
    switch ($match) {
216
        case XOOPS_MATCH_START:
217
            $criteria->add(new \Criteria($name, $ret . '%', 'LIKE'));
218
            break;
219
        case XOOPS_MATCH_END:
220
            $criteria->add(new \Criteria($name, '%' . $ret . '%', 'LIKE'));
221
            break;
222
        case XOOPS_MATCH_EQUAL:
223
            $criteria->add(new \Criteria($name, $ret));
224
            break;
225
        case XOOPS_MATCH_CONTAIN:
226
            $criteria->add(new \Criteria($name, '%' . $ret . '%', 'LIKE'));
227
            break;
228
    }
229
}
230