Issues (1844)

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/ReportParameter.php (1 issue)

Severity
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Xhelp;
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
/**
16
 * @copyright    {@link https://xoops.org/ XOOPS Project}
17
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
18
 * @author       Eric Juden <[email protected]>
19
 * @author       XOOPS Development Team
20
 */
21
22
if (!\defined('XHELP_CLASS_PATH')) {
23
    exit();
24
}
25
26
/**
27
 * ReportParameter class
28
 *
29
 * Information about an individual report parameter
30
 *
31
 * @author  Eric Juden <[email protected]>
32
 */
33
class ReportParameter
34
{
35
    public $controltype;
36
    public $dbaction;
37
    public $dbfield;
38
    public $fieldlength;
39
    public $fieldname;
40
    public $maxlength;
41
    public $name;
42
    public $value;
43
    public $values;
44
45
    /**
46
     * ReportParameter constructor.
47
     */
48
    public function __construct()
49
    {
50
        // Contructor
51
    }
52
53
    /**
54
     * Create a new ReportParameter
55
     *
56
     * @return ReportParameter {@link ReportParameter}
57
     */
58
    public static function create(): ReportParameter
59
    {
60
        $ret = new ReportParameter();
61
62
        return $ret;
63
    }
64
65
    /**
66
     * Add a new report parameter
67
     *
68
     * @param int    $controltype
69
     * @param string $name
70
     * @param string $fieldname
71
     * @param string $value
72
     * @param array  $values
73
     * @param int    $fieldlength
74
     * @param string $dbfield
75
     * @param string $dbaction
76
     *
77
     * @return object {@link ReportParameter}
78
     */
79
    public static function addParam(int $controltype, string $name, string $fieldname, string $value, array $values, int $fieldlength, string $dbfield, string $dbaction)
80
    {
81
        $param              = self::create();
82
        $param->controltype = $controltype;
83
        $param->name        = $name;
84
        $param->fieldname   = $fieldname;
85
        $param->value       = $value;
86
        $param->values      = $values;
87
        $param->fieldlength = $fieldlength;
88
        $param->maxlength   = (\min($fieldlength, 50));
89
        $param->dbfield     = $dbfield;
90
        $param->dbaction    = $dbaction;
91
92
        return $param;
93
    }
94
95
    /**
96
     * Creates the html to display a parameter on the report
97
     *
98
     * @param array $vals
99
     * @return string
100
     */
101
    public function displayParam(array $vals = []): ?string
102
    {
103
        $controltype = $this->controltype;
104
        $fieldlength = $this->maxlength;
0 ignored issues
show
The assignment to $fieldlength is dead and can be removed.
Loading history...
105
106
        if (!empty($vals) && isset($vals[$this->fieldname])) {
107
            if (\is_array($vals[$this->fieldname])) {
108
                $this->values = $vals[$this->fieldname][0];
109
                $this->value  = $vals[$this->fieldname][1];
110
            } else {
111
                $this->value = $vals[$this->fieldname];
112
            }
113
        }
114
115
        switch ($controltype) {
116
            case \XHELP_CONTROL_TXTBOX:
117
                return "<label for='" . $this->fieldname . "'>" . $this->name . '</label>' . "<input type='text' name='" . $this->fieldname . "' id='" . $this->fieldname . "' value='" . $this->value . "' maxlength='" . $this->maxlength . "' size='" . $this->fieldlength . "'>";
118
            case \XHELP_CONTROL_TXTAREA:
119
                return "<label for='" . $this->fieldname . "'>" . $this->name . '</label>' . "<textarea name='" . $this->fieldname . "' id='" . $this->fieldname . "' cols='" . $this->fieldlength . "' rows='5'>" . $this->value . '</textarea>';
120
            case \XHELP_CONTROL_SELECT:
121
                $ret = "<label for='" . $this->fieldname . "'>" . $this->name . '</label>' . "<select name='" . $this->fieldname . "' id='" . $this->fieldname . "' size='1'>";
122
                foreach ($this->values as $key => $value) {
123
                    $ret .= "<option value='" . $key . "' " . (($this->value == $key) ? 'selected' : '') . '>' . $value . '</option>';
124
                }
125
                $ret .= '</select>';
126
127
                return $ret;
128
            case \XHELP_CONTROL_MULTISELECT:
129
                $ret = "<label for='" . $this->fieldname . "'>" . $this->name . '</label>' . "<select name='" . $this->fieldname . "' id='" . $this->fieldname . "' size='3' multiple='multiple'>";
130
                foreach ($this->values as $key => $value) {
131
                    $ret .= "<option value='" . $key . "' " . (($this->value == $key) ? 'selected' : '') . '>' . $value . '</option>';
132
                }
133
                $ret .= '</select>';
134
135
                return $ret;
136
            case \XHELP_CONTROL_YESNO:
137
                return "<label for='"
138
                       . $this->fieldname
139
                       . "'>"
140
                       . $this->name
141
                       . '</label>'
142
                       . "<input type='radio' name='"
143
                       . $this->fieldname
144
                       . "' id='"
145
                       . $this->fieldname
146
                       . "1' value='1' "
147
                       . ((1 == $this->value) ? 'checked' : '')
148
                       . '>'
149
                       . \_XHELP_TEXT_YES
150
                       . "<input type='radio' name='"
151
                       . $this->fieldname
152
                       . "' id='"
153
                       . $this->fieldname
154
                       . "0' value='0' "
155
                       . ((1 == $this->value) ? 'checked' : '')
156
                       . '>'
157
                       . \_XHELP_TEXT_NO;
158
            case \XHELP_CONTROL_RADIOBOX:
159
                $ret = "<label for='" . $this->fieldname . "'>" . $this->name . '</label>';
160
                foreach ($this->values as $key => $value) {
161
                    $ret .= "<input type='checkbox' name='" . $this->fieldname . "' id='" . $this->fieldname . "1' value='1' " . (($key == $this->value) ? 'checked' : '') . '>' . $value;
162
                }
163
164
                return $ret;
165
            case \XHELP_CONTROL_DATETIME:
166
                return "<label for='" . $this->fieldname . "'>" . $this->name . '</label>' . "<input type='text' name='" . $this->fieldname . "' id='" . $this->fieldname . "' value='" . $this->value . "' maxlength='" . $this->maxlength . "' size='" . $this->fieldlength . "'>";
167
            default:
168
                return "<label for='" . $this->fieldname . "'>" . $this->name . '</label>' . "<input type='text' name='" . $this->fieldname . "' id='" . $this->fieldname . "' value='" . $this->value . "' maxlength='" . $this->maxlength . "' size='" . $this->fieldlength . "'>";
169
        }
170
    }
171
}
172