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.

blocks/membersonline_block.php (7 issues)

1
<?php
2
//  Author: SMD & Trabis
3
//  URL: http://www.xoopsmalaysia.org  & http://www.xuups.com
4
//  E-Mail: [email protected]  & [email protected]
5
6
if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
7
8
function show_membersonline_block($options) {
9
    global $xoopsConfig, $xoopsUser, $xoopsModule, $xoopsDB, $_SERVER;
10
11
    /* @var XoopsOnlineHandler $online_handler */
12
    $online_handler = xoops_getHandler('online');
13
    // set gc probabillity to 10% for now..
14
    if (mt_rand(1, 100) < 11) {
15
        $online_handler->gc(300);
16
    }
17
    if (is_object($xoopsUser)) {
18
        $uid   = $xoopsUser->getVar('uid');
19
		$name = $xoopsUser->getVar('name');
20
		if ($options[4]=='1' && $name!='')
21
		  {
22
        $uname = $xoopsUser->getVar('name');
23
		  }
24
		else {
25
		$uname = $xoopsUser->getVar('uname');
26
		}			
27
28
	} else {
29
        $uid   = 0;
30
        $uname = '';	
31
   	    $name = '';
0 ignored issues
show
The assignment to $name is dead and can be removed.
Loading history...
32
    }
33
    $requestIp = \Xmf\IPAddress::fromRequest()->asReadable();
34
    $requestIp = (false === $requestIp) ? '0.0.0.0' : $requestIp;
0 ignored issues
show
The condition false === $requestIp is always false.
Loading history...
35
    if (is_object($xoopsModule)) {
36
        $online_handler->write($uid, $uname, time(), $xoopsModule->getVar('mid'), $requestIp);
37
    } else {
38
        $online_handler->write($uid, $uname, time(), 0, $requestIp);
39
    }
40
    $onlines = $online_handler->getAll();
41
    if (!empty($onlines)) {
42
        $total   = count($onlines);
43
		$block   = array();
44
        $guests  = 0;
45
        $membersname = '';
46
		$membersavatar = '';
0 ignored issues
show
The assignment to $membersavatar is dead and can be removed.
Loading history...
47
		$avatar = '';
0 ignored issues
show
The assignment to $avatar is dead and can be removed.
Loading history...
48
		$uid = '';
0 ignored issues
show
The assignment to $uid is dead and can be removed.
Loading history...
49
        $name = '';
50
        $onlineUsers = [];
51
		for ($i = 0; $i < $total; ++$i) {
52
			  if ($onlines[$i]['online_uid'] == 0) {
53
                    $onlineUsers[$i]['user'] = '';
54
                } else {
55
                    $onlineUsers[$i]['user'] =  new XoopsUser($onlines[$i]['online_uid']);
56
                }
57
			 if (is_object($onlineUsers[$i]['user'])) {
58
					$block['avatar'] = $onlineUsers[$i]['user']->getVar('user_avatar');
59
                    $block['uid']= $onlineUsers[$i]['user']->getVar('uid');
60
					
61
					$realname     = $onlineUsers[$i]['user']->getVar('name');
62
					if ('1' == $options[5] && '' != $realname) {
63
					$block['name'] = $onlineUsers[$i]['user']->getVar('name');
64
					} else {
65
					$block['name'] = $onlineUsers[$i]['user']->getVar('uname');
66
					}
67
					}
68
				
69
            if ($onlines[$i]['online_uid'] > 0) {
70
				$membersname .= '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $onlines[$i]['online_uid'] . '" title="' . $onlines[$i]['online_uname'] . '">' . $onlines[$i]['online_uname'] . '</a>, ';
71
            } else {
72
                ++$guests;
73
            }
74
        }
75
        $block['online_total'] = sprintf(_ONLINEPHRASE, $total);
76
        if (is_object($xoopsModule)) {
77
            $mytotal = $online_handler->getCount(new Criteria('online_module', $xoopsModule->getVar('mid')));
78
            $block['online_total'] .= ' (' . sprintf(_ONLINEPHRASEX, $mytotal, $xoopsModule->getVar('name')) . ')';
79
        }
80
        // Membership Statistic
81
        /** @var \XoopsMemberHandler $member_handler */
82
        $member_handler     =xoops_gethandler('member');
83
        $today              = formatTimestamp(time());
0 ignored issues
show
The assignment to $today is dead and can be removed.
Loading history...
84
        $level_criteria     = new Criteria('level', 0, '>');
85
        $criteria           = new CriteriaCompo($level_criteria);
86
        $criteria24         = new CriteriaCompo($level_criteria);
87
        $criteria48         = new CriteriaCompo($level_criteria);
88
        $total_active_users = $member_handler->getUserCount($level_criteria);
89
        //Fixing stats for last 24 and 48 hours
90
        $users_reg_24 = $member_handler->getUserCount($criteria24->add(new Criteria('user_regdate', (mktime(0,0,0)-(24*3600)), '>=')),'AND');
0 ignored issues
show
The call to XoopsMemberHandler::getUserCount() has too many arguments starting with 'AND'. ( Ignorable by Annotation )

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

90
        /** @scrutinizer ignore-call */ 
91
        $users_reg_24 = $member_handler->getUserCount($criteria24->add(new Criteria('user_regdate', (mktime(0,0,0)-(24*3600)), '>=')),'AND');

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. Please note the @ignore annotation hint above.

Loading history...
91
        $users_reg_48 = $member_handler->getUserCount($criteria48->add(new Criteria('user_regdate', (mktime(0,0,0)-(48*3600)), '>=')),'AND');
92
        $limit = 1;
93
        $criteria->setOrder('DESC');
94
        $criteria->setSort('user_regdate');
95
        $criteria->setLimit($limit);
96
  
97
		// data
98
        $block['activeusers'] = $total_active_users;
99
        $block['todayreg'] = $users_reg_24;
100
        $block['yesterdayreg'] = $users_reg_48 - $users_reg_24;
101
		$block['total_online']	= sprintf(_MB_XOOPSMEMBERS_TOTALONLINE, $total); 
102
		$block['online_members'] = $total - $guests  . ' ' . _MB_XOOPSMEMBERS_MEMBERS . ' ' . _MB_XOOPSMEMBERS_CURRENTONLINE;
103
        $block['online_guests']  = $guests . ' ' . _MB_XOOPSMEMBERS_GUESTS . ' ' . _MB_XOOPSMEMBERS_AND;
104
			
105
  	
106
		$block['showonlinemember'] = $options[0];
107
	    $block['showonlinename'] = $options[1];
108
		$block['showonlineavatar'] = $options[2];
109
		$block['showonlinepopup'] = $options[3];
110
	    $block['showtotalonline'] = $options[4];
111
		$block['userealname'] = $options[5];
112
		$block['memberdisplay'] = $options[6];
113
114
        return $block;
115
	} else {
116
		return false;
117
	}
118
}
119
120
function membersonline_edit($options) {
121
122
    $chk = '';
123
	$form = _MB_XOOPSMEMBERS_SHOWONLINEMEMBER."&nbsp;";
124
	if ( $options[0] == 1 ) {
125
		$chk = " checked='checked'";
126
	}
127
	$form .= "<input type='radio' name='options[0]' value='1'".$chk." />&nbsp;"._YES."";
128
	if ( $options[0] == 0 ) {
129
		$chk = " checked='checked'";
130
	}
131
	$form .= "&nbsp;<input type='radio' name='options[0]' value='0'".$chk." />"._NO."<br />";
132
133
	$form .= _MB_XOOPSMEMBERS_SHOWONLINENAME."&nbsp;";
134
	if ( $options[1] == 1 ) {
135
		$chk = " checked='checked'";
136
	}
137
	$form .= "<input type='radio' name='options[1]' value='1'".$chk." />&nbsp;"._YES."";
138
	$chk = "";
139
	if ( $options[1] == 0 ) {
140
		$chk = " checked='checked'";
141
	}
142
	$form .= "&nbsp;<input type='radio' name='options[1]' value='0'".$chk." />"._NO."<br />";
143
144
	$form .= _MB_XOOPSMEMBERS_SHOWONLINEAVATAR."&nbsp;";
145
	if ( $options[2] == 1 ) {
146
		$chk = " checked='checked'";
147
	}
148
	$form .= "<input type='radio' name='options[2]' value='1'".$chk." />&nbsp;"._YES."";
149
	$chk = "";
150
	if ( $options[2] == 0 ) {
151
		$chk = " checked='checked'";
152
	}
153
	$form .= "&nbsp;<input type='radio' name='options[2]' value='0'".$chk." />"._NO."<br />";
154
155
	$form .= _MB_XOOPSMEMBERS_SHOWONLINEPOPUP."&nbsp;";
156
	if ( $options[3] == 1 ) {
157
		$chk = " checked='checked'";
158
	}
159
	$form .= "<input type='radio' name='options[3]' value='1'".$chk." />&nbsp;"._YES."";
160
	$chk = "";
161
	if ( $options[3] == 0 ) {
162
		$chk = " checked='checked'";
163
	}
164
	$form .= "&nbsp;<input type='radio' name='options[3]' value='0'".$chk." />"._NO."<br />";
165
166
	$form .= _MB_XOOPSMEMBERS_SHOWTOTALONLINE."&nbsp;";
167
	if ( $options[4] == 1 ) {
168
		$chk = " checked='checked'";
169
	}
170
	$form .= "<input type='radio' name='options[4]' value='1'".$chk." />&nbsp;"._YES."";
171
	$chk = "";
172
	if ( $options[4] == 0 ) {
173
		$chk = " checked='checked'";
174
	}
175
	$form .= "&nbsp;<input type='radio' name='options[4]' value='0'".$chk." />"._NO."<br />";
176
177
	$form .= _MB_XOOPSMEMBERS_USEREALNAME."&nbsp;";
178
	if ( $options[5] == 1 ) {
179
		$chk = " checked='checked'";
180
	}
181
	$form .= "<input type='radio' name='options[5]' value='1'".$chk." />&nbsp;"._YES."";
182
	$chk = "";
183
	if ( $options[5] == 0 ) {
184
		$chk = " checked='checked'";
185
	}
186
	$form .= "&nbsp;<input type='radio' name='options[5]' value='0'".$chk." />"._NO."<br />";
187
	
188
	$form .= _MB_XOOPSMEMBERS_MEMBERDISPLAY."&nbsp;";
189
	$form .= "<input type='text' name='options[6]' value='".$options[6]."'/>";
190
	return $form;
191
}
192
193