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