Issues (304)

Security Analysis    not enabled

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

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

include/onupdate.php (6 issues)

Upgrade to new PHP Analysis Engine

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
 *  userlog module
13
 *
14
 * @copyright       XOOPS Project (https://xoops.org)
15
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
16
 * @package         userlog include
17
 * @since           1
18
 * @author          irmtfan ([email protected])
19
 * @author          XOOPS Project <www.xoops.org> <www.xoops.ir>
20
 */
21
defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
22
require_once __DIR__ . '/common.php';
23
24
/**
25
 * @param XoopsModule $module
26
 * @param null        $prev_version
27
 *
28
 * @return bool|mixed
29
 */
30
31
function xoops_module_update_userlog(XoopsModule $module, $prev_version = null)
0 ignored issues
show
The function xoops_module_update_userlog() has been defined more than once; this definition is ignored, only the first definition in include/module.php (L42-70) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
32
{
33
    if ($prev_version == round($module->getInfo('version') * 100, 2)) {
34
        $module->setErrors('You have the latest ' . $module->getInfo('name') . ' module (' . $module->getInfo('dirname') . ' version ' . $module->getInfo('version') . ') and update is not necessary');
35
        print_r($module->getErrors());
36
37
        return true;
38
    }
39
    $ret = true;
40
    // first db update
41
    if (100 == $prev_version) {
42
        $ret = update_userlog_v100($module);
43
    }
44
    if ($prev_version < 114) {
45
        $ret = update_userlog_v114($module);
46
    }
47
    if ($prev_version < 115) {
48
        $ret = update_userlog_v115($module);
49
    }
50
    if ($prev_version < 116) {
51
        $ret = update_userlog_v116($module);
52
    }
53
    $errors = $module->getErrors();
54
    if (!empty($errors)) {
55
        print_r($errors);
56
    }
57
58
    return $ret;
59
}
60
61
// update database from v1 to 1.01 (Beta1 to RC1)
62
// module_name VARCHAR(25) change to VARCHAR(50)
63
/**
64
 * @param XoopsModule $module
65
 *
66
 * @return bool
67
 */
68 View Code Duplication
function update_userlog_v100(XoopsModule $module)
0 ignored issues
show
The function update_userlog_v100() has been defined more than once; this definition is ignored, only the first definition in include/module.php (L79-94) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
69
{
70
    $field   = 'module_name';
71
    $userlog  = Userlog::getInstance();
72
    $ret     = $userlog->getHandler('log')->showFields($field);
73
    preg_match_all('!\d+!', $ret[$field]['Type'], $nums);
74
    // only change if module_name Type was VARCHAR(25)
75
    if (25 == $nums[0][0]) {
76
        $ret2 = $userlog->getHandler('log')->changeField($field, "VARCHAR(50) NOT NULL default ''");
77
    } else {
78
        $ret2 = true;
79
        $module->setErrors("Your table field ({$field}) with size {$ret[$field]['Type']} don't need change.");
80
    }
81
82
    return $ret2;
83
}
84
85
// add ",active,inside,outside,unset_pass" to all settings
86
/**
87
 * @param XoopsModule $module
88
 *
89
 * @return bool
90
 */
91 View Code Duplication
function update_userlog_v114(XoopsModule $module)
0 ignored issues
show
The function update_userlog_v114() has been defined more than once; this definition is ignored, only the first definition in include/module.php (L102-119) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
92
{
93
    $userlog    = Userlog::getInstance();
94
    $logsetsObj = $userlog->getHandler('setting')->getAll();
95
    $ret        = true;
96
    foreach ($logsetsObj as $setObj) {
97
        if (strpos($setObj->getVar('options'), 'active')) {
98
            continue;
99
        }
100
        $setObj->setVar('options', $setObj->getVar('options') . ',active,inside,outside,unset_pass');
101
        if (!$setObj->storeSet(true)) {
102
            $ret = false;
103
            $module->setErrors(_AM_USERLOG_SET_ERROR . ' id=' . $setObj->set_id() . ' options=' . $setObj->options());
104
        }
105
    }
106
107
    return $ret;
108
}
109
110
/**
111
 * @param XoopsModule $module
112
 *
113
 * @return mixed
114
 */
115 View Code Duplication
function update_userlog_v115(XoopsModule $module)
0 ignored issues
show
The function update_userlog_v115() has been defined more than once; this definition is ignored, only the first definition in include/module.php (L126-145) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
116
{
117
    $userlog  = Userlog::getInstance();
118
    // Only change the field from INDEX to UNIQUE if it is not unique
119
    // if (isset($indexArr[0]["Non_unique"]) || $indexArr[0]["Non_unique"] == 1) { }
120
    // change the index in _stats table
121
    if (!$ret = $userlog->getHandler('stats')->changeIndex('stats_type_link_period', ['stats_type', 'stats_link', 'stats_period'], 'UNIQUE')) {
122
        $module->setErrors("'stats_type_link_period' index is not changed to unique. Warning: do not use module until you change this index to unique.");
123
    }
124
    // drop the index in _log table
125
    if (!$ret = $userlog->getHandler('log')->dropIndex('log_id_uid')) {
126
        $module->setErrors("'log_id_uid' index is not dropped.");
127
    }
128
    // add the index in _log table
129
    if (!$ret = $userlog->getHandler('log')->addIndex('log_time', ['log_time'])) {
130
        $module->setErrors("'log_time' index is not added.");
131
    }
132
133
    return $ret;
134
}
135
136
/**
137
 * @param XoopsModule $module
138
 *
139
 * @return bool
140
 */
141 View Code Duplication
function update_userlog_v116(XoopsModule $module)
0 ignored issues
show
The function update_userlog_v116() has been defined more than once; this definition is ignored, only the first definition in include/module.php (L152-165) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
142
{
143
    // remove old html template files
144
    $template_directory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/templates/';
145
    $template_list      = array_diff(scandir($template_directory, SCANDIR_SORT_NONE), ['..', '.']);
146
    foreach ($template_list as $k => $v) {
147
        $fileinfo = new SplFileInfo($template_directory . $v);
148
        if ('html' === $fileinfo->getExtension() && 'index.html' !== $fileinfo->getFilename()) {
149
            @unlink($template_directory . $v);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
150
        }
151
    }
152
153
    return true;
154
}
155