Issues (432)

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

1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Suico;
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
use Xmf\Module\Helper\Permission;
16
use XoopsDatabaseFactory;
17
use XoopsObject;
18
19
/**
20
 * @category        Module
21
 * @copyright       {@link https://xoops.org/ XOOPS Project}
22
 * @license         GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
23
 * @author          Marcello Brandão aka  Suico, Mamba, LioMJ  <https://xoops.org>
24
 */
25
26
/**
27
 * Includes of form objects and uploader
28
 */
29
require_once XOOPS_ROOT_PATH . '/class/uploader.php';
30
require_once XOOPS_ROOT_PATH . '/kernel/object.php';
31
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
32
33
/**
34
 * Image class.
35
 * $this class is responsible for providing data access mechanisms to the data source
36
 * of XOOPS user class objects.
37
 */
38
class Image extends XoopsObject
39
{
40
    public \XoopsDatabase $db;
41
    public Helper         $helper;
42
    public Permission     $permHelper;
43
    public                $image_id;
44
    public $title;
45
    public $caption;
46
    public $date_created;
47
    public $date_updated;
48
    public $uid_owner;
49
    public $filename;
50
    public $private;
51
52
    // constructor
53
    /**
54
     * Image constructor.
55
     * @param null $id
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $id is correct as it would always require null to be passed?
Loading history...
56
     */
57
    public function __construct($id = null)
58
    {
59
        /** @var Helper $helper */
60
        $this->helper     = Helper::getInstance();
61
        $this->permHelper = new Permission();
62
        $this->db         = XoopsDatabaseFactory::getDatabaseConnection();
63
        $this->initVar('image_id', \XOBJ_DTYPE_INT, null, false, 10);
64
        $this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false);
65
        $this->initVar('caption', \XOBJ_DTYPE_TXTBOX, null, false);
66
        $this->initVar('date_created', \XOBJ_DTYPE_INT, 0, false);
67
        $this->initVar('date_updated', \XOBJ_DTYPE_INT, 0, false);
68
        $this->initVar('uid_owner', \XOBJ_DTYPE_TXTBOX, null, false);
69
        $this->initVar('filename', \XOBJ_DTYPE_OTHER, null, false);
70
        $this->initVar('private', \XOBJ_DTYPE_TXTBOX, null, false);
71
        if (!empty($id)) {
72
            if (\is_array($id)) {
73
                $this->assignVars($id);
74
            } else {
75
                $this->load((int)$id);
76
            }
77
        } else {
78
            $this->setNew();
79
        }
80
    }
81
82
    /**
83
     * @param $id
84
     */
85
    public function load($id): void
86
    {
87
        $sql   = 'SELECT * FROM ' . $this->db->prefix('suico_images') . ' WHERE image_id=' . $id;
88
        $myrow = $this->db->fetchArray($this->db->query($sql));
89
        $this->assignVars($myrow);
90
        if (!$myrow) {
91
            $this->setNew();
92
        }
93
    }
94
95
    /**
96
     * @param array  $criteria
97
     * @param bool   $asobject
98
     * @param string $sort
99
     * @param string $order
100
     * @param int    $limit
101
     * @param int    $start
102
     * @return array
103
     */
104
    public function getAllImages(
105
        $criteria = [],
106
        $asobject = false,
107
        $sort = 'image_id',
108
        $order = 'ASC',
109
        $limit = 0,
110
        $start = 0
111
    ) {
112
        $db         = XoopsDatabaseFactory::getDatabaseConnection();
113
        $ret        = [];
114
        $whereQuery = '';
115
        if (\is_array($criteria) && \count($criteria) > 0) {
116
            $whereQuery = ' WHERE';
117
            foreach ($criteria as $c) {
118
                $whereQuery .= " {$c} AND";
119
            }
120
            $whereQuery = mb_substr($whereQuery, 0, -4);
121
        } elseif (!\is_array($criteria) && $criteria) {
122
            $whereQuery = ' WHERE ' . $criteria;
123
        }
124
        if ($asobject) {
125
            $sql    = 'SELECT * FROM ' . $db->prefix('suico_images') . "{$whereQuery} ORDER BY {$sort} {$order}";
126
            $result = $db->query($sql, $limit, $start);
127
            while (false !== ($myrow = $db->fetchArray($result))) {
128
                $ret[] = new self($myrow);
129
            }
130
        } else {
131
            $sql    = 'SELECT image_id FROM ' . $db->prefix('suico_images') . "{$whereQuery} ORDER BY {$sort} {$order}";
132
            $result = $db->query($sql, $limit, $start);
133
            while (false !== ($myrow = $db->fetchArray($result))) {
134
                $ret[] = $myrow['suico_images_id'];
135
            }
136
        }
137
138
        return $ret;
139
    }
140
141
    /**
142
     * Get form
143
     *
144
     * @return \XoopsModules\Suico\Form\ImagesForm
145
     */
146
    public function getForm()
147
    {
148
        return new Form\ImagesForm($this);
149
    }
150
151
    /**
152
     * @return array|null
153
     */
154
    public function getGroupsRead()
155
    {
156
        //$permHelper = new \Xmf\Module\Helper\Permission();
157
        return $this->permHelper->getGroupsForItem(
158
            'sbcolumns_read',
159
            $this->getVar('image_id')
160
        );
161
    }
162
163
    /**
164
     * @return array|null
165
     */
166
    public function getGroupsSubmit()
167
    {
168
        //$permHelper = new \Xmf\Module\Helper\Permission();
169
        return $this->permHelper->getGroupsForItem(
170
            'sbcolumns_submit',
171
            $this->getVar('image_id')
172
        );
173
    }
174
175
    /**
176
     * @return array|null
177
     */
178
    public function getGroupsModeration()
179
    {
180
        //$permHelper = new \Xmf\Module\Helper\Permission();
181
        return $this->permHelper->getGroupsForItem(
182
            'sbcolumns_moderation',
183
            $this->getVar('image_id')
184
        );
185
    }
186
}
187