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/TicketField.php (2 issues)

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       Brian Wahoff <[email protected]>
19
 * @author       XOOPS Development Team
20
 */
21
22
if (!\defined('XHELP_CONSTANTS_INCLUDED')) {
23
    exit();
24
}
25
26
// require_once XHELP_CLASS_PATH . '/BaseObjectHandler.php';
27
28
/**
29
 * Xhelp\TicketField class
30
 *
31
 * Metadata that represents a custom field created for xhelp
32
 *
33
 * @author  Brian Wahoff <[email protected]>
34
 */
35
class TicketField extends \XoopsObject
36
{
37
    public $departments = [];
38
39
    /**
40
     * Class Constructor
41
     *
42
     * @param int|array|null $id null for a new object, hash table for an existing object
43
     */
44
    public function __construct($id = null)
45
    {
46
        $this->initVar('id', \XOBJ_DTYPE_INT, null, false);
47
        $this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, true, 64);
48
        $this->initVar('description', \XOBJ_DTYPE_TXTBOX, '', false, 255);
49
        $this->initVar('fieldname', \XOBJ_DTYPE_TXTBOX, null, true, 64);
50
        $this->initVar('controltype', \XOBJ_DTYPE_INT, \XHELP_CONTROL_TXTBOX, true);
51
        $this->initVar('datatype', \XOBJ_DTYPE_TXTBOX, null, true, 64);
52
        $this->initVar('required', \XOBJ_DTYPE_INT, false, true);
53
        $this->initVar('fieldlength', \XOBJ_DTYPE_INT, 255, true);
54
        $this->initVar('weight', \XOBJ_DTYPE_INT, 0, true);
55
        $this->initVar('fieldvalues', \XOBJ_DTYPE_ARRAY, null, false);
56
        $this->initVar('defaultvalue', \XOBJ_DTYPE_TXTBOX, null, false, 100);
57
        $this->initVar('validation', \XOBJ_DTYPE_TXTBOX, null, false);
58
59
        if (null !== $id) {
60
            if (\is_array($id)) {
61
                $this->assignVars($id);
62
            }
63
        } else {
64
            $this->setNew();
65
        }
66
    }
67
68
    /**
69
     * Get the array of possible values for this custom field
70
     * @param null   $keys
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $keys is correct as it would always require null to be passed?
Loading history...
71
     * @param string $format
72
     * @param int    $maxDepth
73
     */
74
    public function getValues($keys = null, $format = 's', $maxDepth = 1)
75
    {
76
        $this->getVar('fieldvalues');
77
    }
78
79
    /**
80
     * @param Validation\Validator $validator
81
     */
82
    public function addValidator(Validation\Validator $validator): void
83
    {
84
    }
85
86
    /**
87
     * @param array $val_arr
88
     */
89
    public function setValues(array $val_arr): void
90
    {
91
        $this->setVar('fieldvalues', $val_arr);
92
    }
93
94
    /**
95
     * @param array $val_arr
96
     */
97
    public function addValues(array $val_arr): void
98
    {
99
        if (\is_array($val_arr)) {
100
            $values = @$this->getVar('fieldvalues');
101
            if (!\is_array($values)) {
102
                $values = [];
103
            }
104
            foreach ($val_arr as $value => $desc) {
105
                $values[$value] = $desc;
106
            }
107
            $this->setVar('fieldvalues', $values);
108
        }
109
    }
110
111
    /**
112
     * @param string $desc
113
     * @param null   $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
114
     */
115
    public function addValue(string $desc, $value = null): void
116
    {
117
        //Add value to array
118
        $values        = $this->getVar('fieldvalues');
119
        $values[$desc] = $value;
120
        $this->setVar('fieldvalues', $values);
121
    }
122
123
    /**
124
     * @param int $dept
125
     */
126
    public function addDepartment(int $dept): void
127
    {
128
        $dept                     = $dept;
129
        $this->departments[$dept] = $dept;
130
    }
131
132
    /**
133
     * @param array $dept_arr
134
     * @return bool
135
     */
136
    public function addDepartments(array $dept_arr): ?bool
137
    {
138
        if (!\is_array($dept_arr) || 0 == \count($dept_arr)) {
139
            return false;
140
        }
141
        foreach ($dept_arr as $dept) {
142
            $dept                     = (int)$dept;
143
            $this->departments[$dept] = $dept;
144
        }
145
        return true;
146
    }
147
148
    /**
149
     * @param int $dept
150
     */
151
    public function removeDepartment(int $dept): void
152
    {
153
        $dept                     = $dept;
154
        $this->departments[$dept] = 0;
155
    }
156
157
    /**
158
     * @return array
159
     */
160
    public function &getDepartments(): array
161
    {
162
        return $this->departments;
163
    }
164
165
    /**
166
     * @return array
167
     */
168
    public function toArray(): array
169
    {
170
        $arr = [];
171
172
        $values = $this->getVar('fieldvalues');
173
        if (\XHELP_CONTROL_YESNO == $this->getVar('controltype')) {
174
            $values = [1 => _YES, 0 => _NO];
175
        }
176
177
        $aValues = [];
178
        foreach ($values as $key => $value) {
179
            $aValues[] = [$key, $value];
180
        }
181
182
        $arr = [
183
            'id'           => $this->getVar('id'),
184
            'name'         => $this->getVar('name'),
185
            'desc'         => $this->getVar('description'),
186
            'fieldname'    => $this->getVar('fieldname'),
187
            'defaultvalue' => $this->getVar('defaultvalue'),
188
            'currentvalue' => '',
189
            'controltype'  => $this->getVar('controltype'),
190
            'required'     => $this->getVar('required'),
191
            'fieldlength'  => $this->getVar('fieldlength'),
192
            'weight'       => $this->getVar('weight'),
193
            'fieldvalues'  => $aValues,
194
            'datatype'     => $this->getVar('datatype'),
195
            'validation'   => $this->getVar('validation'),
196
        ];
197
198
        return $arr;
199
    }
200
}
201