Issues (411)

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.

class/Dbupdater.php (4 issues)

1
<?php
2
3
namespace XoopsModules\Wfdownloads;
4
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
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
/**
15
 * Wfdownloads module
16
 *
17
 * @copyright       XOOPS Project (https://xoops.org)
18
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
19
 * @package         wfdownload
20
 * @since           3.23
21
 * @author          marcan <[email protected]>, Xoops Development Team
22
 */
23
24
/**
25
 * Contains the classes for updating database tables
26
 *
27
 * @license    GNU
28
 * @author     marcan <[email protected]>
29
 * @link       http://www.smartfactory.ca The SmartFactory
30
 * @package    Wfdownloads
31
 * @subpackage dbUpdater
32
 */
33
34
use XoopsModules\Wfdownloads;
35
36
/**
37
 * Dbupdater class
38
 *
39
 * Class performing the database update for the module
40
 *
41
 * @package Wfdownloads
42
 * @author  marcan <[email protected]>
43
 * @link    http://www.smartfactory.ca The SmartFactory
44
 */
45
class Dbupdater
46
{
47
    public function __construct()
48
    {
49
    }
50
51
    /**
52
     * Use to execute a general query
53
     *
54
     * @param string $query   query that will be executed
55
     * @param string $goodmsg message displayed on success
56
     * @param string $badmsg  message displayed on error
57
     *
58
     * @return bool true if success, false if an error occured
59
     */
60
    public function runQuery($query, $goodmsg, $badmsg)
61
    {
62
        $ret = $GLOBALS['xoopsDB']->query($query);
63
        if (!$ret) {
64
            echo "<li class='err'>$badmsg</li>";
65
66
            return false;
67
        }
68
        echo "<li class='ok'>$goodmsg</li>";
69
70
        return true;
71
    }
72
73
    /**
74
     * Use to rename a table
75
     *
76
     * @param string $from name of the table to rename
77
     * @param string $to   new name of the renamed table
78
     *
79
     * @return bool true if success, false if an error occured
80
     */
81
    public function renameTable($from, $to)
82
    {
83
        $from = $GLOBALS['xoopsDB']->prefix($from);
84
        $to   = $GLOBALS['xoopsDB']->prefix($to);
85
86
        $query = \sprintf('ALTER TABLE %s RENAME %s', $from, $to);
87
        $ret   = $GLOBALS['xoopsDB']->query($query);
88
        if (!$ret) {
89
            echo "<li class='err'>" . \sprintf(\_AM_WFDOWNLOADS_DB_MSG_RENAME_TABLE_ERR, $from) . '</li>';
90
91
            return false;
92
        }
93
        echo "<li class='ok'>" . \sprintf(\_AM_WFDOWNLOADS_DB_MSG_RENAME_TABLE, $from, $to) . '</li>';
94
95
        return true;
96
    }
97
98
    /**
99
     * Use to update a table
100
     *
101
     * @param DbupdaterTable $table {@link DbupdaterTable} that will be updated
102
     *
103
     * @return bool true if success, false if an error occured
104
     */
105
    public function updateTable(DbupdaterTable $table)
106
    {
107
        $ret = true;
108
        echo '<ul>';
109
110
        // If table has a structure, create the table
111
        if ($table->getStructure()) {
112
            $ret = $table->createTable() && $ret;
113
        }
114
115
        // If table is flag for drop, drop it
116
        if ($table->_flagForDrop) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $table->_flagForDrop of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
117
            $ret = $table->dropTable() && $ret;
118
        }
119
120
        // If table has data, insert it
121
        if ($table->getData()) {
122
            $ret = $table->addData() && $ret;
123
        }
124
125
        // If table has new fields to be added, add them
126
        if ($table->getNewFields()) {
127
            $ret = $table->addNewFields() && $ret;
128
        }
129
130
        // If table has altered field, alter the table
131
        if ($table->getAlteredFields()) {
132
            $ret = $table->alterTable() && $ret;
133
        }
134
135
        // If table has updated field values, update the table
136
        if ($table->getUpdatedFields()) {
137
            $ret = $table->updateFieldsValues($table) && $ret;
0 ignored issues
show
The call to XoopsModules\Wfdownloads...e::updateFieldsValues() has too many arguments starting with $table. ( Ignorable by Annotation )

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

137
            $ret = $table->/** @scrutinizer ignore-call */ updateFieldsValues($table) && $ret;

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...
138
        }
139
140
        // If table has droped field, alter the table
141
        if ($table->getDropedFields()) {
142
            $ret = $table->dropFields($table) && $ret;
0 ignored issues
show
The call to XoopsModules\Wfdownloads...aterTable::dropFields() has too many arguments starting with $table. ( Ignorable by Annotation )

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

142
            $ret = $table->/** @scrutinizer ignore-call */ dropFields($table) && $ret;

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...
143
        }
144
        //felix
145
        // If table has updated field values, update the table
146
        if ($table->getUpdatedWhere()) {
147
            $ret = $table->updateWhereValues($table) && $ret;
0 ignored issues
show
The call to XoopsModules\Wfdownloads...le::updateWhereValues() has too many arguments starting with $table. ( Ignorable by Annotation )

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

147
            $ret = $table->/** @scrutinizer ignore-call */ updateWhereValues($table) && $ret;

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...
148
        }
149
150
        echo '</ul>';
151
152
        return $ret;
153
    }
154
}
155