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/TicketEmailsHandler.php (10 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       Eric Juden <[email protected]>
19
 * @author       XOOPS Development Team
20
 */
21
22
// require_once XHELP_CLASS_PATH . '/BaseObjectHandler.php';
23
24
/**
25
 * TicketEmailsHandler class
26
 *
27
 * Department Handler for Department class
28
 *
29
 * @author  Eric Juden <[email protected]> &
30
 */
31
class TicketEmailsHandler extends BaseObjectHandler
32
{
33
    /**
34
     * Name of child class
35
     *
36
     * @var string
37
     */
38
    public $classname = TicketEmails::class;
39
    /**
40
     * DB table name
41
     *
42
     * @var string
43
     */
44
    public $dbtable = 'xhelp_ticket_submit_emails';
45
46
    private const TABLE = 'xhelp_ticket_submit_emails';
47
    private const ENTITY = TicketEmails::class;
48
    private const ENTITYNAME = 'TicketEmails';
49
    private const KEYNAME = 'ticketid';
50
    private const IDENTIFIER = 'uid';
51
52
    /**
53
     * Constructor
54
     *
55
     * @param \XoopsMySQLDatabase|null $db reference to a xoopsDB object
56
     */
57
    public function __construct(\XoopsMySQLDatabase $db = null)
58
    {
59
        $this->init($db);
60
        $this->helper = Helper::getInstance();
61
        parent::__construct($db, static::TABLE, static::ENTITY, static::KEYNAME, static::IDENTIFIER);
62
    }
63
64
    /**
65
     * @param \XoopsObject $object
66
     * @return string
67
     */
68
    public function insertQuery(\XoopsObject $object): string
69
    {
70
        //TODO mb replace with individual variables
71
        // Copy all object vars into local variables
72
        foreach ($object->cleanVars as $k => $v) {
73
            ${$k} = $v;
74
        }
75
76
        $sql = \sprintf('INSERT INTO `%s` (ticketid, uid, email, suppress) VALUES (%u, %u, %s, %u)', $this->db->prefix($this->dbtable), $ticketid, $uid, $this->db->quoteString($email), $suppress);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $ticketid seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $uid seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $suppress seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $email seems to be never defined.
Loading history...
77
78
        return $sql;
79
    }
80
81
    /**
82
     * @param \XoopsObject|null $object
83
     * @return string
84
     */
85
    public function deleteQuery(\XoopsObject $object = null): string
86
    {
87
        $sql = \sprintf('DELETE FROM `%s` WHERE ticketid = %u', $this->db->prefix($this->dbtable), $object->getVar('ticketid'));
0 ignored issues
show
It seems like $object->getVar('ticketid') can also be of type array and array; however, parameter $values of sprintf() does only seem to accept double|integer|string, maybe add an additional type check? ( Ignorable by Annotation )

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

87
        $sql = \sprintf('DELETE FROM `%s` WHERE ticketid = %u', $this->db->prefix($this->dbtable), /** @scrutinizer ignore-type */ $object->getVar('ticketid'));
Loading history...
The method getVar() does not exist on null. ( Ignorable by Annotation )

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

87
        $sql = \sprintf('DELETE FROM `%s` WHERE ticketid = %u', $this->db->prefix($this->dbtable), $object->/** @scrutinizer ignore-call */ getVar('ticketid'));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
88
89
        return $sql;
90
    }
91
92
    /**
93
     * @param \XoopsObject $object
94
     * @return string
95
     */
96
    public function updateQuery(\XoopsObject $object): string
97
    {
98
        //TODO mb replace with individual variables
99
        // Copy all object vars into local variables
100
        foreach ($object->cleanVars as $k => $v) {
101
            ${$k} = $v;
102
        }
103
104
        $sql = \sprintf('UPDATE `%s` SET suppress = %u WHERE ticketid = %u AND uid = %u AND email = %s', $this->db->prefix($this->dbtable), $suppress, $ticketid, $uid, $this->db->quoteString($email));
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $ticketid seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $uid seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $email seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $suppress seems to be never defined.
Loading history...
105
106
        return $sql;
107
    }
108
109
    /**
110
     * retrieve objects from the database
111
     *
112
     * @param \CriteriaElement|\CriteriaCompo|null $criteria  {@link CriteriaElement} conditions to be met
113
     * @param bool                                 $id_as_key Should the department ID be used as array key
114
     * @return array  array of {@link Department} objects
115
     */
116
    public function &getObjects(\CriteriaElement $criteria = null, $id_as_key = false, $as_object = true): array
117
    {
118
        $ret   = [];
119
        $limit = $start = 0;
120
        $sql   = $this->selectQuery($criteria);
121
        if (null !== $criteria) {
122
            $limit = $criteria->getLimit();
123
            $start = $criteria->getStart();
124
        }
125
126
        $result = $this->db->query($sql, $limit, $start);
127
        // If no records from db, return empty array
128
        if (!$result) {
129
            return $ret;
130
        }
131
132
        // Add each returned record to the result array
133
        while (false !== ($myrow = $this->db->fetchArray($result))) {
134
            $object                        = new $this->classname($myrow);
135
            $ret[$object->getVar('email')] = $object;
136
            unset($object);
137
        }
138
139
        return $ret;
140
    }
141
142
    /**
143
     * retrieve objects from the database
144
     *
145
     * @param \CriteriaElement|\CriteriaCompo|null $criteria {@link CriteriaElement} conditions to be met
146
     * @return array array of <a href='psi_element://Department'>Department</a> objects
147
     *                                                       objects
148
     * @internal param bool $id_as_key Should the department ID be used as array key
149
     */
150
    public function &getObjectsSortedByTicket($criteria = null): array
151
    {
152
        $ret   = [];
153
        $limit = $start = 0;
154
        $sql   = $this->selectQuery($criteria);
155
        if (null !== $criteria) {
156
            $limit = $criteria->getLimit();
157
            $start = $criteria->getStart();
158
        }
159
160
        $result = $this->db->query($sql, $limit, $start);
161
        // If no records from db, return empty array
162
        if (!$result) {
163
            return $ret;
164
        }
165
166
        // Add each returned record to the result array
167
        while (false !== ($myrow = $this->db->fetchArray($result))) {
168
            $object                           = new $this->classname($myrow);
169
            $ret[$object->getVar('ticketid')] = $object;
170
            unset($object);
171
        }
172
173
        return $ret;
174
    }
175
}
176