Issues (68)

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
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   http://www.fsf.org/copyleft/gpl.html GNU public license
15
 * @package   Xoops Members
16
 * @since     2.3.0
17
 * @author    onokazu
18
 * @author    John Neill
19
 */
20
21
use Xmf\Request;
22
23
$GLOBALS['xoopsOption']['template_main'] = 'xoopsmembers_index.tpl';
24
require_once __DIR__ . '/header.php';
25
26
//global $pathIcon16;
27
28
global $xoopsModule;
29
30
if ('datatables1' == $xoopsModuleConfig['indextemplate'] || 'datatables2' == $xoopsModuleConfig['indextemplate'] || 'datatables3' == $xoopsModuleConfig['indextemplate']) {
31
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/jquery.dataTables.css');
32
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/responsive.dataTables.min.css');
33
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/jquery.dataTables.js');
34
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/dataTables.responsive.min.js');
35
}
36
if ('datatables3' == $xoopsModuleConfig['indextemplate']) {
37
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/dataTables.alphabetSearch.css');
38
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/dataTables.alphabetSearch.js');
39
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/jquery.dataTables.css');
40
    $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/responsive.dataTables.min.css');
41
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/jquery.dataTables.js');
42
    $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/dataTables.responsive.min.js');
43
}
44
45
/** @var \XoopsMemberHandler $memberHandler */
46
$memberHandler = xoops_getHandler('member');
47
$total         = $memberHandler->getUserCount(new \Criteria('level', 0, '>'));
48
49
$iamadmin = $xoopsUserIsAdmin;
50
$myts     = \MyTextSanitizer::getInstance();
51
$criteria = new \CriteriaCompo();
52
53
$criteria->add(new \Criteria('level', 0, '>'));
54
$validsort = ['uname', 'name', 'last_login', 'user_regdate', 'posts'];
55
//$sort      = (!in_array($helper->getModule()->getInfo('sortmembers'), $validsort)) ? 'uname' : $helper->getModule()->getInfo('sortmembers');
56
//temp solution
57
$sort = (!in_array($xoopsModuleConfig['sortmembers'], $validsort)) ? 'uname' : $xoopsModuleConfig['sortmembers'];
58
59
$order = 'ASC';
60
//$temp  = $helper->getModule()->getInfo('membersorder');
61
//temp solution
62
if (isset($xoopsModuleConfig['membersorder']) && $xoopsModuleConfig['membersorder'] == 'DESC') {
63
    //if (isset($temp) && 'DESC' == $temp) {
64
    $order = 'DESC';
65
}
66
67
if ('normal' == $xoopsModuleConfig['indextemplate']) {
68
    //temp solution
69
    $limit = (!empty($xoopsModuleConfig['membersperpage'])) ? intval($xoopsModuleConfig['membersperpage']) : 20;
70
    //$limit = \Xmf\Request::getInt('limit', 20, 'POST');
71
    if (0 == $limit || $limit > 50) {
72
        $limit = 50;
73
    }
74
}
75
$start = Request::getInt('start', 0, 'POST');
76
$total = $memberHandler->getUserCount($criteria);
77
$xoopsTpl->assign('totalmember', $total);
78
79
//Show last member
80
$result = $GLOBALS['xoopsDB']->query('SELECT uid, uname FROM ' . $GLOBALS['xoopsDB']->prefix('users') . ' WHERE level > 0 ORDER BY uid DESC', 1, 0);
81
[$latestuid, $latestuser] = $GLOBALS['xoopsDB']->fetchRow($result);
82
$xoopsTpl->assign('latestmember', " <a href='" . XOOPS_URL . '/userinfo.php?uid=' . $latestuid . "'>" . $latestuser . '</a>');
83
$xoopsTpl->assign('welcomemessage', $xoopsModuleConfig['welcomemessage']);
84
85
if (0 == $total) {
86
} elseif ($start < $total) {
87
    if ($iamadmin) {
88
        $xoopsTpl->assign('is_admin', true);
89
    }
90
    $criteria->setSort($sort);
91
    $criteria->setOrder($order);
92
    $criteria->setStart($start);
93
    if ('normal' == $xoopsModuleConfig['indextemplate']) {
94
        $criteria->setLimit($limit);
95
    }
96
    $foundusers = $memberHandler->getUsers($criteria, true);
97
    foreach (array_keys($foundusers) as $j) {
98
        $userdata['avatar']   = $foundusers[$j]->getVar('user_avatar');
99
        $userdata['realname'] = $foundusers[$j]->getVar('name');
100
        $userdata['name']     = $foundusers[$j]->getVar('uname');
101
        $userdata['id']       = $foundusers[$j]->getVar('uid');
102
        if (1 == $foundusers[$j]->getVar('user_viewemail') || $iamadmin) {
103
            $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>';
104
            $userdata['emailaddress'] = $foundusers[$j]->getVar('email');
105
        }
106
        if ($xoopsUser) {
107
            $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(
108
                    _SENDPMTO,
109
                    $foundusers[$j]->getVar(
110
                        'uname',
111
                        'e'
112
                    )
113
                ) . '"></a>';
114
            $userdata['pm']     = $foundusers[$j]->getVar('uid');
115
        }
116
        if ('' != $foundusers[$j]->getVar('url', 'e')) {
117
            $userdata['website'] = '<a href="' . $foundusers[$j]->getVar('url', 'e') . '" target="_blank"><img src="' . XOOPS_URL . '/images/icons/www.gif" border="0" alt="' . _VISITWEBSITE . '"></a>';
118
        }
119
        $userdata['url']          = $foundusers[$j]->getVar('url', 'e');
120
        $userdata['registerdate'] = formatTimestamp($foundusers[$j]->getVar('user_regdate'), 's');
121
        if (0 != $foundusers[$j]->getVar('last_login')) {
122
            $userdata['lastlogin'] = formatTimestamp($foundusers[$j]->getVar('last_login'), 'm');
123
        } else {
124
            $userdata['lastlogin'] = _MD_XOOPSMEMBERS_NEVERLOGIN;
125
        }
126
        $userdata['posts'] = $foundusers[$j]->getVar('posts');
127
        if ($iamadmin) {
128
            $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 . "'>"
129
130
                                     . '</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>';
131
        }
132
133
        $userdata['location']     = $foundusers[$j]->getVar('user_from');
134
        $userdata['occupation']   = $foundusers[$j]->getVar('user_occ');
135
        $userdata['interest']     = $foundusers[$j]->getVar('user_intrest');
136
        $userdata['extrainfo']    = $foundusers[$j]->getVar('bio');
137
        $userdata['signature']    = $foundusers[$j]->getVar('user_sig');
138
        $userdata['onlinestatus'] = $foundusers[$j]->isOnline();
139
        $userrank                 = $foundusers[$j]->rank();
140
        if ($userrank['image']) {
141
            $userdata['rankimage'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="">';
142
        }
143
        $userdata['ranktitle'] = $userrank['title'];
144
145
        $uid        = $userdata['id'];
146
        $groups     = $memberHandler->getGroupsByUser($uid, true);
147
        $usergroups = [];
148
        foreach ($groups as $group) {
149
            $usergroups[] = $group->getVar('name');
150
        }
151
        $userdata['groups'] = implode(', ', $usergroups);
152
153
        $xoopsTpl->append('users', $userdata);
154
    }
155
    if ('normal' == $xoopsModuleConfig['indextemplate']) {
156
        $totalpages = ceil($total / $limit);
157
        if ($totalpages > 1) {
158
            $hiddenform = '<form name="findnext" action="index.php" method="post">';
159
            foreach ($_POST as $k => $v) {
160
                $hiddenform .= '<input type="hidden" name="' . htmlspecialchars($k) . '" value="' . $myts->previewTarea($v) . '">';
161
            }
162
            if (!isset($_POST['limit'])) {
163
                $hiddenform .= '<input type="hidden" name="limit" value="' . $limit . '">';
164
            }
165
            if (!isset($_POST['start'])) {
166
                $hiddenform .= '<input type="hidden" name="start" value="' . $start . '">';
167
            }
168
            $prev = $start - $limit;
169
            if ($start - $limit >= 0) {
170
                $hiddenform .= '<a href="#0" onclick="javascript:document.findnext.start.value=' . $prev . ';document.findnext.submit();">' . _MD_XOOPSMEMBERS_PREVIOUS . '</a>&nbsp;';
171
            }
172
            $counter     = 1;
173
            $currentpage = ($start + $limit) / $limit;
174
            while ($counter <= $totalpages) {
175
                if ($counter == $currentpage) {
176
                    $hiddenform .= '<b>' . $counter . '</b> ';
177
                } elseif (($counter > $currentpage - 4 && $counter < $currentpage + 4) || 1 == $counter || $counter == $totalpages) {
178
                    if ($counter == $totalpages && $currentpage < $totalpages - 4) {
179
                        $hiddenform .= '... ';
180
                    }
181
                    $hiddenform .= '<a href="#' . $counter . '" onclick="javascript:document.findnext.start.value=' . ($counter - 1) * $limit . ';document.findnext.submit();">' . $counter . '</a> ';
182
                    if (1 == $counter && $currentpage > 5) {
183
                        $hiddenform .= '... ';
184
                    }
185
                }
186
                $counter++;
187
            }
188
            $next = $start + $limit;
189
            if ($total > $next) {
190
                $hiddenform .= '&nbsp;<a href="#' . $total . '" onclick="javascript:document.findnext.start.value=' . $next . ';document.findnext.submit();">' . _MD_XOOPSMEMBERS_NEXT . '</a>';
191
            }
192
            $hiddenform .= '</form>';
193
            $xoopsTpl->assign('pagenav', $hiddenform);
194
            $xoopsTpl->assign('lang_numfound', sprintf(_MD_XOOPSMEMBERS_USERSFOUND, $total));
195
        }
196
    }
197
}
198
199
require __DIR__ . '/footer.php';
200
require_once XOOPS_ROOT_PATH . '/footer.php';
201
exit();
202
203
/**
204
 * xoops_Criteria()
205
 *
206
 * @param \CriteriaCompo $criteria
207
 * @param string         $name
208
 * @param string         $ret
209
 * @param string         $match
210
 * @return void
211
 */
212
function xoops_Criteria(&$criteria, $name = '', $ret = '', $match = '')
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

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

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