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

Labels
1
<?php declare(strict_types=1);
2
3
4
namespace XoopsModules\Wgevents;
5
6
/*
7
 You may not change or alter any portion of this comment or credits
8
 of supporting developers from this source code or any supporting source code
9
 which is considered copyrighted (c) material of the original comment or credit authors.
10
11
 This program is distributed in the hope that it will be useful,
12
 but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
*/
15
16
/**
17
 * wgEvents module for xoops
18
 *
19
 * @copyright    2021 XOOPS Project (https://xoops.org)
20
 * @license      GPL 2.0 or later
21
 * @package      wgevents
22
 * @since        1.0.0
23
 * @min_xoops    2.5.11 Beta1
24
 * @author       Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com
25
 */
26
27
use XoopsModules\Wgevents;
28
29
\defined('XOOPS_ROOT_PATH') || die('Restricted access');
30
31
/**
32
 * Class Object Answer
33
 */
34
class Answer extends \XoopsObject
35
{
36
    /**
37
     * @var int
38
     */
39
    public $start = 0;
40
41
    /**
42
     * @var int
43
     */
44
    public $limit = 0;
45
46
    /**
47
     * Constructor
48
     *
49
     */
50
    public function __construct()
51
    {
52
        $this->initVar('id', \XOBJ_DTYPE_INT);
53
        $this->initVar('regid', \XOBJ_DTYPE_INT);
54
        $this->initVar('queid', \XOBJ_DTYPE_INT);
55
        $this->initVar('evid', \XOBJ_DTYPE_INT);
56
        $this->initVar('text', \XOBJ_DTYPE_TXTBOX);
57
        $this->initVar('datecreated', \XOBJ_DTYPE_INT);
58
        $this->initVar('submitter', \XOBJ_DTYPE_INT);
59
    }
60
61
    /**
62
     * @static function &getInstance
63
     *
64
     */
65
    public static function getInstance()
66
    {
67
        static $instance = false;
68
        if (!$instance) {
69
            $instance = new self();
70
        }
71
    }
72
73
    /**
74
     * The new inserted $Id
75
     * @return inserted id
0 ignored issues
show
The type XoopsModules\Wgevents\inserted was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
76
     */
77
    public function getNewInsertedId()
78
    {
79
        return $GLOBALS['xoopsDB']->getInsertId();
80
    }
81
82
    /**
83
     * @public function getForm
84
     * @param bool $action
85
     * @return \XoopsThemeForm
86
     */
87
    public function getForm($action = false)
88
    {
89
        $helper = \XoopsModules\Wgevents\Helper::getInstance();
90
        if (!$action) {
91
            $action = $_SERVER['REQUEST_URI'];
92
        }
93
        $isAdmin = (\is_object($GLOBALS['xoopsUser']) && \is_object($GLOBALS['xoopsModule'])) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false;
94
        // Title
95
        $title = $this->isNew() ? \_MA_WGEVENTS_ANSWER_ADD : \_MA_WGEVENTS_ANSWER_EDIT;
96
        // Get Theme Form
97
        \xoops_load('XoopsFormLoader');
98
        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
99
        $form->setExtra('enctype="multipart/form-data"');
100
        // Form Table registrations
101
        $registrationHandler = $helper->getHandler('Registration');
102
        $ansResidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_ANSWER_REGID, 'regid', $this->getVar('regid'));
103
        $ansResidSelect->addOptionArray($registrationHandler->getList());
104
        $form->addElement($ansResidSelect);
105
        // Form Table questions
106
        $questionHandler = $helper->getHandler('Question');
107
        $ansAddidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_ANSWER_QUEID, 'queid', $this->getVar('queid'));
108
        $crQuestion = new \CriteriaCompo();
109
        $crQuestion->add(new \Criteria('evid', $this->getVar('evid')));
110
        $questionsCount = $questionHandler->getCount($crQuestion);
111
        // Table view questions
112
        if ($questionsCount > 0) {
113
            $crQuestion->setSort('weight ASC, id');
114
            $crQuestion->setOrder('DESC');
115
            $questionsAll = $questionHandler->getAll($crQuestion);
116
            foreach (\array_keys($questionsAll) as $i) {
117
                $ansAddidSelect->addOption($questionsAll[$i]->getVar('id'), $questionsAll[$i]->getVar('caption'));
118
            }
119
        }
120
        $form->addElement($ansAddidSelect);
121
        // Form Table events
122
        $eventHandler = $helper->getHandler('Event');
123
        $ansEvidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_ANSWER_EVID, 'evid', $this->getVar('evid'));
124
        $ansEvidSelect->addOptionArray($eventHandler->getList());
125
        $form->addElement($ansEvidSelect);
126
        // Form Text ansText
127
        $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_ANSWER_TEXT, 'text', 50, 255, $this->getVar('text')));
128
        // Form Text Date Select ansDatecreated
129
        $ansDatecreated = $this->isNew() ? \time() : $this->getVar('datecreated');
130
        $form->addElement(new \XoopsFormTextDateSelect(\_MA_WGEVENTS_DATECREATED, 'datecreated', '', $ansDatecreated));
131
        // Form Select User ansSubmitter
132
        $uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0;
133
        $ansSubmitter = $this->isNew() ? $uidCurrent : $this->getVar('submitter');
134
        $form->addElement(new \XoopsFormSelectUser(\_MA_WGEVENTS_SUBMITTER, 'submitter', false, $ansSubmitter));
135
        // To Save
136
        $form->addElement(new \XoopsFormHidden('op', 'save'));
137
        $form->addElement(new \XoopsFormHidden('start', $this->start));
138
        $form->addElement(new \XoopsFormHidden('limit', $this->limit));
139
        $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false));
140
        return $form;
141
    }
142
143
    /**
144
     * Get Values
145
     * @param null $keys
146
     * @param null $format
147
     * @param null $maxDepth
148
     * @return array
149
     */
150
    public function getValuesAnswers($keys = null, $format = null, $maxDepth = null)
151
    {
152
        $helper  = \XoopsModules\Wgevents\Helper::getInstance();
153
        $ret = $this->getValues($keys, $format, $maxDepth);
154
        $questionHandler = $helper->getHandler('Question');
155
        $questionObj = $questionHandler->get($this->getVar('queid'));
156
        $queCaption = '';
157
        if (\is_object($questionObj)) {
158
            $queCaption = $questionObj->getVar('caption');
159
        }
160
        $ret['quecaption']       = $queCaption;
161
        $eventHandler = $helper->getHandler('Event');
162
        $eventObj = $eventHandler->get($this->getVar('evid'));
163
        $evName = 'invalid event';
164
        if (\is_object($eventObj)) {
165
            $evName = $eventObj->getVar('name');
166
        }
167
        $ret['eventname']        = $evName;
168
        $ret['datecreated_text'] = \formatTimestamp($this->getVar('datecreated'), 's');
169
        $ret['submitter_text']   = \XoopsUser::getUnameFromId($this->getVar('submitter'));
170
        return $ret;
171
    }
172
173
    /**
174
     * Returns an array representation of the object
175
     *
176
     * @return array
177
     */
178
    /*
179
    public function toArray()
180
    {
181
        $ret = [];
182
        $vars = $this->getVars();
183
        foreach (\array_keys($vars) as $var) {
184
            $ret[$var] = $this->getVar($var);
185
        }
186
        return $ret;
187
    }
188
    */
189
}
190