Issues (277)

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

1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Wgevents;
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
 * wgEvents module for xoops
17
 *
18
 * @copyright    2021 XOOPS Project (https://xoops.org)
19
 * @license      GPL 2.0 or later
20
 * @package      wgevents
21
 * @since        1.0.0
22
 * @min_xoops    2.5.11 Beta1
23
 * @author       Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com
24
 */
25
26
use XoopsModules\Wgevents;
27
28
29
/**
30
 * Class Object Handler Textblock
31
 */
32
class TextblockHandler extends \XoopsPersistableObjectHandler
33
{
34
    /**
35
     * Constructor
36
     *
37
     * @param \XoopsDatabase $db
38
     */
39
    public function __construct(\XoopsDatabase $db)
40
    {
41
        parent::__construct($db, 'wgevents_textblock', Textblock::class, 'id', 'name');
42
    }
43
44
    /**
45
     * @param bool $isNew
46
     *
47
     * @return object
48
     */
49
    public function create($isNew = true)
50
    {
51
        return parent::create($isNew);
52
    }
53
54
    /**
55
     * retrieve a field
56
     *
57
     * @param int $id field id
58
     * @param $fields
59
     * @return \XoopsObject|null reference to the {@link Get} object
60
     */
61
    public function get($id = null, $fields = null)
62
    {
63
        return parent::get($id, $fields);
64
    }
65
66
    /**
67
     * get inserted id
68
     *
69
     * @return int reference to the {@link Get} object
70
     */
71
    public function getInsertId()
72
    {
73
        return $this->db->getInsertId();
74
    }
75
76
    /**
77
     * Get Count Textblock in the database
78
     * @param int    $start
79
     * @param int    $limit
80
     * @param string $sort
81
     * @param string $order
82
     * @return int
83
     */
84
    public function getCountTextblocks($start = 0, $limit = 0, $sort = 'weight ASC, id', $order = 'ASC')
85
    {
86
        $crCountTextblocks = new \CriteriaCompo();
87
        $crCountTextblocks = $this->getTextblocksCriteria($crCountTextblocks, $start, $limit, $sort, $order);
88
        return $this->getCount($crCountTextblocks);
89
    }
90
91
    /**
92
     * Get All Textblock in the database
93
     * @param int    $start
94
     * @param int    $limit
95
     * @param string $sort
96
     * @param string $order
97
     * @return array
98
     */
99
    public function getAllTextblocks($start = 0, $limit = 0, $sort = 'weight ASC, id', $order = 'ASC')
100
    {
101
        $crAllTextblocks = new \CriteriaCompo();
102
        $crAllTextblocks = $this->getTextblocksCriteria($crAllTextblocks, $start, $limit, $sort, $order);
103
        return $this->getAll($crAllTextblocks);
104
    }
105
106
    /**
107
     * Get Criteria Textblock
108
     * @param        $crTextblock
109
     * @param int $start
110
     * @param int $limit
111
     * @param string $sort
112
     * @param string $order
113
     * @return int
114
     */
115
    private function getTextblocksCriteria($crTextblock, int $start, int $limit, string $sort, string $order)
116
    {
117
        $crTextblock->setStart($start);
118
        $crTextblock->setLimit($limit);
119
        $crTextblock->setSort($sort);
120
        $crTextblock->setOrder($order);
121
        return $crTextblock;
122
    }
123
124
    /**
125
     * @public function getForm
126
     * param array $textblockAll
127
     * @param bool $action
128
     * @return \XoopsThemeForm
129
     */
130
    public function getFormSelect($textblockAll, $action = false)
131
    {
132
        $helper = Helper::getInstance();
133
        //$categoryHandler = $helper->getHandler('Category');
134
        $questionHandler = $helper->getHandler('Question');
135
136
        if (!$action) {
137
            $action = $_SERVER['REQUEST_URI'];
138
        }
139
140
        // Get Theme Form
141
        \xoops_load('XoopsFormLoader');
142
        $form = new \XoopsThemeForm(\_MA_WGEVENTS_TEXTBLOCK_ADD, 'form', $action, 'post', true);
143
        $form->setExtra('enctype="multipart/form-data"');
144
145
        // Get All Textblock
146
        $selectTextblockTray = new \XoopsFormElementTray(\_MA_WGEVENTS_TEXTBLOCKS_LIST, '<br>');
147
        foreach (\array_keys($textblockAll) as $i) {
148
            $caption = $textblockAll[$i]->getVar('name');
149
            $text = $textblockAll[$i]->getVar('text');
150
            $value = '<p>' . $caption . '</p>' . $text;
151
            // Form Check Box
152
            $checkTextblock[$i] = new \XoopsFormCheckBox('', 'cbTextblock[' . $i . ']', 0);
153
            $checkTextblock[$i]->addOption(1, $caption);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $checkTextblock seems to be defined later in this foreach loop on line 152. Are you sure it is defined here?
Loading history...
154
            $selectTextblockTray->addElement($checkTextblock[$i]);
155
            $selectTextblockTray->addElement(new \XoopsFormLabel('', $text));
156
        }
157
        $form->addElement($selectTextblockTray);
158
159
        // To Save
160
        $form->addElement(new \XoopsFormHidden('op', 'save_textblock'));
161
        $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false));
162
        return $form;
163
    }
164
165
    /**
166
     * @public function to get next value for sorting
167
     *
168
     * @return int
169
     */
170
    public function getNextWeight()
171
    {
172
        $nextValue = 0;
173
174
        $crField = new \CriteriaCompo();
175
        $crField->setSort('weight');
176
        $crField->setOrder('DESC');
177
        $crField->setLimit(1);
178
        $fieldsCount = $this->getCount($crField);
179
        if ($fieldsCount > 0) {
180
            $fieldsAll = $this->getAll($crField);
181
            foreach (\array_keys($fieldsAll) as $i) {
182
                $nextValue = $fieldsAll[$i]->getVar('weight');
183
            }
184
        }
185
186
        return $nextValue + 1;
187
188
    }
189
}
190