Issues (311)

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/Task.php (3 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
6
namespace XoopsModules\Wgevents;
7
8
/*
9
 You may not change or alter any portion of this comment or credits
10
 of supporting developers from this source code or any supporting source code
11
 which is considered copyrighted (c) material of the original comment or credit authors.
12
13
 This program is distributed in the hope that it will be useful,
14
 but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
*/
17
18
/**
19
 * wgEvents module for xoops
20
 *
21
 * @copyright    2021 XOOPS Project (https://xoops.org)
22
 * @license      GPL 2.0 or later
23
 * @package      wgevents
24
 * @since        1.0.0
25
 * @min_xoops    2.5.11 Beta1
26
 * @author       Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com
27
 */
28
29
use XoopsModules\Wgevents;
30
31
\defined('XOOPS_ROOT_PATH') || die('Restricted access');
32
33
/**
34
 * Class Object Task
35
 */
36
class Task extends \XoopsObject
37
{
38
    /**
39
     * Constructor
40
     *
41
     */
42
    public function __construct()
43
    {
44
        $this->initVar('id', \XOBJ_DTYPE_INT);
45
        $this->initVar('type', \XOBJ_DTYPE_INT);
46
        $this->initVar('params', \XOBJ_DTYPE_TXTAREA);
47
        $this->initVar('recipient', \XOBJ_DTYPE_TXTBOX);
48
        $this->initVar('datecreated', \XOBJ_DTYPE_INT);
49
        $this->initVar('submitter', \XOBJ_DTYPE_INT);
50
        $this->initVar('status', \XOBJ_DTYPE_INT);
51
        $this->initVar('datedone', \XOBJ_DTYPE_INT);
52
    }
53
54
    /**
55
     * @static function &getInstance
56
     *
57
     */
58
    public static function getInstance()
59
    {
60
        static $instance = false;
61
        if (!$instance) {
62
            $instance = new self();
63
        }
64
    }
65
66
    /**
67
     * The new inserted $Id
68
     * @return inserted id
69
     */
70
    public function getNewInsertedIdTasks()
71
    {
72
        return $GLOBALS['xoopsDB']->getInsertId();
73
    }
74
75
    /**
76
     * @public function getForm
77
     * @param bool $action
78
     * @return \XoopsThemeForm
79
     */
80
    public function getFormTasks($action = false)
81
    {
82
        if (!$action) {
83
            $action = $_SERVER['REQUEST_URI'];
84
        }
85
        // Title
86
        $title = $this->isNew() ? \_AM_WGEVENTS_ADD_TASK : \_AM_WGEVENTS_EDIT_TASK;
87
        // Get Theme Form
88
        \xoops_load('XoopsFormLoader');
89
        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
90
        $form->setExtra('enctype="multipart/form-data"');
91
        // Form Select taskType
92
        $form->addElement(new \XoopsFormText(\_AM_WGEVENTS_TASK_TYPE, 'type', 50, 255, $this->getVar('type')));
93
        // Form Editor TextArea taskParams
94
        $form->addElement(new \XoopsFormTextArea(\_AM_WGEVENTS_TASK_PARAMS, 'params', $this->getVar('params', 'e'), 10, 47));
95
        // Form Editor TextArea taskRecipient
96
        $form->addElement(new \XoopsFormText(\_AM_WGEVENTS_TASK_RECIPIENT, 'recipient', 50, 255, $this->getVar('recipient')));
97
        // Form Text Date Select taskDatecreated
98
        $taskDatecreated = $this->isNew() ? \time() : $this->getVar('datecreated');
99
        $form->addElement(new \XoopsFormDateTime(\_MA_WGEVENTS_DATECREATED, 'datecreated', '', $taskDatecreated), true);
100
        // Form Select User taskSubmitter
101
        $uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0;
102
        $taskSubmitter = $this->isNew() ? $uidCurrent : $this->getVar('submitter');
103
        $form->addElement(new \XoopsFormSelectUser(\_MA_WGEVENTS_SUBMITTER, 'submitter', false, $taskSubmitter), true);
104
        // Form Select Status taskStatus
105
        $taskStatusSelect = new \XoopsFormSelect(\_MA_WGEVENTS_STATUS, 'status', $this->getVar('status'));
106
        $taskStatusSelect->addOption(Constants::STATUS_NONE, \_MA_WGEVENTS_STATUS_NONE);
107
        $taskStatusSelect->addOption(Constants::STATUS_PENDING, \_MA_WGEVENTS_STATUS_PENDING);
108
        $taskStatusSelect->addOption(Constants::STATUS_PROCESSING, \_MA_WGEVENTS_STATUS_PROCESSING);
109
        $taskStatusSelect->addOption(Constants::STATUS_DONE, \_MA_WGEVENTS_STATUS_DONE);
110
        $form->addElement($taskStatusSelect, true);
111
        // Form Text Date Select taskDatedone
112
        $taskDatedone = $this->isNew() ? \time() : $this->getVar('datedone');
113
        $form->addElement(new \XoopsFormDateTime(\_AM_WGEVENTS_TASK_DATEDONE, 'datedone', '', $taskDatedone), true);
114
        // To Save
115
        $form->addElement(new \XoopsFormHidden('op', 'save'));
116
        $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false));
117
        return $form;
118
    }
119
120
    /**
121
     * Get Values
122
     * @param null $keys
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $keys is correct as it would always require null to be passed?
Loading history...
123
     * @param null $format
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $format is correct as it would always require null to be passed?
Loading history...
124
     * @param null $maxDepth
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $maxDepth is correct as it would always require null to be passed?
Loading history...
125
     * @return array
126
     */
127
    public function getValuesTasks($keys = null, $format = null, $maxDepth = null)
128
    {
129
        $helper  = \XoopsModules\Wgevents\Helper::getInstance();
130
        $utility = new \XoopsModules\Wgevents\Utility();
131
        $editorMaxchar = $helper->getConfig('editor_maxchar');
132
        $ret = $this->getValues($keys, $format, $maxDepth);
133
        $ret['type_text']    = $this->getMailNotificationText($this->getVar('type'));
134
        $ret['params_text']    = $this->getVar('params', 'e');
135
        $ret['params_short']   = $utility::truncateHtml($ret['params'], $editorMaxchar);
136
        $ret['datecreated_text'] = \formatTimestamp($this->getVar('datecreated'), 'm');
137
        $ret['submitter_text']   = \XoopsUser::getUnameFromId($this->getVar('submitter'));
138
        $ret['status_text']      = Utility::getStatusText($this->getVar('status'));
139
        $ret['datedone_text']    = \formatTimestamp($this->getVar('datedone'), 'm');
140
        return $ret;
141
    }
142
143
    /**
144
     * @public function to get text constants mail notification
145
     * @param $const
146
     * @return string
147
     */
148
    public function getMailNotificationText($const)
149
    {
150
        switch ($const) {
151
            case Constants::MAIL_REG_CONFIRM_IN:
152
                $const_text = 'MAIL_REG_CONFIRM_IN';
153
                break;
154
            case Constants::MAIL_REG_CONFIRM_OUT:
155
                $const_text = 'MAIL_REG_CONFIRM_OUT';
156
                break;
157
            case Constants::MAIL_REG_CONFIRM_MODIFY:
158
                $const_text = 'MAIL_REG_CONFIRM_MODIFY';
159
                break;
160
            case Constants::MAIL_REG_NOTIFY_IN:
161
                $const_text = 'MAIL_REG_NOTIFY_IN';
162
                break;
163
            case Constants::MAIL_REG_NOTIFY_OUT:
164
                $const_text = 'MAIL_REG_NOTIFY_OUT';
165
                break;
166
            case Constants::MAIL_REG_NOTIFY_MODIFY:
167
                $const_text = 'MAIL_REG_NOTIFY_MODIFY';
168
                break;
169
            case Constants::MAIL_EVENT_NOTIFY_MODIFY:
170
                $const_text = 'MAIL_EVENT_NOTIFY_MODIFY';
171
                break;
172
            case Constants::MAIL_EVENT_NOTIFY_ALL:
173
                $const_text = 'MAIL_EVENT_NOTIFY_ALL';
174
                break;
175
            case Constants::MAIL_REG_NOTIFY_CANCEL:
176
                $const_text = 'MAIL_REG_NOTIFY_CANCEL';
177
                break;
178
            case Constants::MAIL_REG_CONFIRM_CANCEL:
179
                $const_text = 'MAIL_REG_CONFIRM_CANCEL';
180
                break;
181
            case 0:
182
            default:
183
                $const_text = 'invalid constant text';
184
                break;
185
        }
186
187
        return $const_text;
188
    }
189
190
    /**
191
     * Returns an array representation of the object
192
     *
193
     * @return array
194
     */
195
    public function toArrayTasks()
196
    {
197
        $ret = [];
198
        $vars = $this->getVars();
199
        foreach (\array_keys($vars) as $var) {
200
            $ret[$var] = $this->getVar($var);
201
        }
202
        return $ret;
203
    }
204
}
205