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/Friendrequest.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          Bruno Barthez, 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
require_once XOOPS_ROOT_PATH . '/kernel/object.php';
27
28
/**
29
 * Friendrequest class.
30
 * $this class is responsible for providing data access mechanisms to the data source
31
 * of XOOPS user class objects.
32
 */
33
class Friendrequest extends XoopsObject
34
{
35
    public \XoopsDatabase $db;
36
    public Helper         $helper;
37
    public Permission     $permHelper;
38
    public                $friendreq_id;
39
    public $friendrequester_uid;
40
    public $friendrequestto_uid;
41
    public $date_created;
42
    // constructor
43
44
    /**
45
     * Friendrequest constructor.
46
     * @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...
47
     */
48
    public function __construct($id = null)
49
    {
50
        /** @var Helper $helper */
51
        $this->helper     = Helper::getInstance();
52
        $this->permHelper = new Permission();
53
        $this->db         = XoopsDatabaseFactory::getDatabaseConnection();
54
        $this->initVar('friendreq_id', \XOBJ_DTYPE_INT, null, false, 10);
55
        $this->initVar('friendrequester_uid', \XOBJ_DTYPE_INT, null, false, 10);
56
        $this->initVar('friendrequestto_uid', \XOBJ_DTYPE_INT, null, false, 10);
57
        $this->initVar('date_created', \XOBJ_DTYPE_INT, 0, false);
58
        if (!empty($id)) {
59
            if (\is_array($id)) {
60
                $this->assignVars($id);
61
            } else {
62
                $this->load((int)$id);
63
            }
64
        } else {
65
            $this->setNew();
66
        }
67
    }
68
69
    /**
70
     * @param $id
71
     */
72
    public function load($id): void
73
    {
74
        $sql   = 'SELECT * FROM ' . $this->db->prefix('suico_friendrequests') . ' WHERE friendreq_id=' . $id;
75
        $myrow = $this->db->fetchArray($this->db->query($sql));
76
        $this->assignVars($myrow);
77
        if (!$myrow) {
78
            $this->setNew();
79
        }
80
    }
81
82
    /**
83
     * @param array  $criteria
84
     * @param bool   $asobject
85
     * @param string $sort
86
     * @param string $order
87
     * @param int    $limit
88
     * @param int    $start
89
     * @return array
90
     */
91
    public function getAllFriendrequests(
92
        $criteria = [],
93
        $asobject = false,
94
        $sort = 'friendreq_id',
95
        $order = 'ASC',
96
        $limit = 0,
97
        $start = 0
98
    ) {
99
        $db         = XoopsDatabaseFactory::getDatabaseConnection();
100
        $ret        = [];
101
        $whereQuery = '';
102
        if (\is_array($criteria) && \count($criteria) > 0) {
103
            $whereQuery = ' WHERE';
104
            foreach ($criteria as $c) {
105
                $whereQuery .= " {$c} AND";
106
            }
107
            $whereQuery = mb_substr($whereQuery, 0, -4);
108
        } elseif (!\is_array($criteria) && $criteria) {
109
            $whereQuery = ' WHERE ' . $criteria;
110
        }
111
        if ($asobject) {
112
            $sql    = 'SELECT * FROM ' . $db->prefix(
113
                    'suico_friendrequests'
114
                ) . "{$whereQuery} ORDER BY {$sort} {$order}";
115
            $result = $db->query($sql, $limit, $start);
116
            while (false !== ($myrow = $db->fetchArray($result))) {
117
                $ret[] = new self($myrow);
118
            }
119
        } else {
120
            $sql    = 'SELECT friendreq_id FROM ' . $db->prefix(
121
                    'suico_friendrequests'
122
                ) . "{$whereQuery} ORDER BY {$sort} {$order}";
123
            $result = $db->query($sql, $limit, $start);
124
            while (false !== ($myrow = $db->fetchArray($result))) {
125
                $ret[] = $myrow['suico_friendrequest_id'];
126
            }
127
        }
128
129
        return $ret;
130
    }
131
132
    /**
133
     * Get form
134
     *
135
     * @return \XoopsModules\Suico\Form\FriendrequestForm
136
     */
137
    public function getForm()
138
    {
139
        return new Form\FriendrequestForm($this);
140
    }
141
142
    /**
143
     * @return array|null
144
     */
145
    public function getGroupsRead()
146
    {
147
        //$permHelper = new \Xmf\Module\Helper\Permission();
148
        return $this->permHelper->getGroupsForItem(
149
            'sbcolumns_read',
150
            $this->getVar('friendreq_id')
151
        );
152
    }
153
154
    /**
155
     * @return array|null
156
     */
157
    public function getGroupsSubmit()
158
    {
159
        //$permHelper = new \Xmf\Module\Helper\Permission();
160
        return $this->permHelper->getGroupsForItem(
161
            'sbcolumns_submit',
162
            $this->getVar('friendreq_id')
163
        );
164
    }
165
166
    /**
167
     * @return array|null
168
     */
169
    public function getGroupsModeration()
170
    {
171
        //$permHelper = new \Xmf\Module\Helper\Permission();
172
        return $this->permHelper->getGroupsForItem(
173
            'sbcolumns_moderation',
174
            $this->getVar('friendreq_id')
175
        );
176
    }
177
}
178