Issues (62)

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/Error.php (5 issues)

1
<?php
2
3
namespace XoopsModules\Xhttperror;
4
5
/**
6
 * ****************************************************************************
7
 *  - A Project by Developers TEAM For Xoops - ( https://xoops.org )
8
 * ****************************************************************************
9
 *  XHTTPERROR - MODULE FOR XOOPS
10
 *  Copyright (c) 2007 - 2012
11
 *  Rota Lucio ( http://luciorota.altervista.org/xoops/ )
12
 *
13
 *  You may not change or alter any portion of this comment or credits
14
 *  of supporting developers from this source code or any supporting
15
 *  source code which is considered copyrighted (c) material of the
16
 *  original comment or credit authors.
17
 *
18
 *  This program is distributed in the hope that it will be useful,
19
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 *  GNU General Public License for more details.
22
 *  ---------------------------------------------------------------------------
23
 * @copyright  Rota Lucio ( http://luciorota.altervista.org/xoops/ )
24
 * @license    GNU General Public License v3.0
25
 * @package    xhttperror
26
 * @author     Rota Lucio ( [email protected] )
27
 *
28
 *  $Rev$:     Revision of last commit
29
 *  $Author$:  Author of last commit
30
 *  $Date$:    Date of last commit
31
 * ****************************************************************************
32
 */
33
34
\define('XHTTPERR_REDIRECT_NO', 0);
35
\define('XHTTPERR_REDIRECT_URI', 1);
36
\define('XHTTPERR_REDIRECT_PREVIOUS', 2);
37
38
/**
39
 * Class Error
40
 * @package XoopsModules\Xhttperror
41
 */
42
class Error extends \XoopsObject
43
{
44
    // constructor
45
    public function __construct()
46
    {
47
        parent::__construct();
48
        $this->initVar('error_id', \XOBJ_DTYPE_INT, null, false, 5);
49
        $this->initVar('error_title', \XOBJ_DTYPE_TXTBOX, null, true);
50
        $this->initVar('error_statuscode', \XOBJ_DTYPE_TXTBOX, '000', true);
51
        $this->initVar('error_text', \XOBJ_DTYPE_TXTAREA, null, false, '');
0 ignored issues
show
'' of type string is incompatible with the type integer expected by parameter $maxlength of XoopsObject::initVar(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

51
        $this->initVar('error_text', \XOBJ_DTYPE_TXTAREA, null, false, /** @scrutinizer ignore-type */ '');
Loading history...
52
        $this->initVar('error_text_html', \XOBJ_DTYPE_INT, true, false); // default: true
53
        $this->initVar('error_text_smiley', \XOBJ_DTYPE_INT, true, false); // default: true
54
        $this->initVar('error_text_breaks', \XOBJ_DTYPE_INT, false, false); // default: false
55
        $this->initVar('error_showme', \XOBJ_DTYPE_INT, true, false); // default: true
56
        $this->initVar('error_redirect', \XOBJ_DTYPE_INT, \XHTTPERR_REDIRECT_NO, false); // default: XHTTPERR_REDIRECT_NO
57
        $this->initVar('error_redirect_time', \XOBJ_DTYPE_INT, 3, false); // default: 3 seconds
58
        $this->initVar('error_redirect_message', \XOBJ_DTYPE_TXTBOX, '', false); // IN PROGRESS
59
        $this->initVar('error_redirect_uri', \XOBJ_DTYPE_URL, XOOPS_URL, false); // default XOOPS_URL
60
    }
61
62
    /**
63
     * @param bool $action
64
     * @return \XoopsThemeForm
65
     */
66
    public function getForm($action = false)
67
    {
68
        global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
69
70
        if (false === $action) {
71
            $action = $_SERVER['REQUEST_URI'];
72
        }
73
        $title = $this->isNew() ? \sprintf(\_AM_XHTTPERR_ERROR_ADD) : \sprintf(\_AM_XHTTPERR_ERROR_EDIT);
74
75
        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
76
77
        $formObj = new \XoopsThemeForm($title, 'form_error', $action, 'post', true);
78
        $formObj->setExtra('enctype="multipart/form-data"');
79
80
        // Title
81
        $errorTitle = new \XoopsFormText(\_AM_XHTTPERR_ERROR_TITLE, 'error_title', 40, 255, $this->getVar('error_title'));
0 ignored issues
show
It seems like $this->getVar('error_title') can also be of type array and array; however, parameter $value of XoopsFormText::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

81
        $errorTitle = new \XoopsFormText(\_AM_XHTTPERR_ERROR_TITLE, 'error_title', 40, 255, /** @scrutinizer ignore-type */ $this->getVar('error_title'));
Loading history...
82
        $errorTitle->setDescription(\_AM_XHTTPERR_ERROR_TITLE_DESC);
83
        $formObj->addElement($errorTitle, true);
84
        unset($errorTitle);
85
        // Error number
86
        if ($this->isNew()) {
87
            $errorStatuscode = new \XoopsFormText(\_AM_XHTTPERR_ERROR_STATUSCODE, 'error_statuscode', 3, 3, $this->getVar('error_statuscode'));
88
        } else {
89
            $errorStatuscode = new \XoopsFormLabel(\_AM_XHTTPERR_ERROR_STATUSCODE, $this->getVar('error_statuscode'));
0 ignored issues
show
It seems like $this->getVar('error_statuscode') can also be of type array and array; however, parameter $value of XoopsFormLabel::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

89
            $errorStatuscode = new \XoopsFormLabel(\_AM_XHTTPERR_ERROR_STATUSCODE, /** @scrutinizer ignore-type */ $this->getVar('error_statuscode'));
Loading history...
90
        }
91
        $formObj->addElement($errorStatuscode, true);
92
        unset($errorStatuscode);
93
        // Text
94
        $editor_configs           = [];
95
        $editor_configs['name']   = 'error_text';
96
        $editor_configs['value']  = $this->getVar('error_text', 'e');
97
        $editor_configs['rows']   = 10;
98
        $editor_configs['cols']   = 50;
99
        $editor_configs['width']  = '100%';
100
        $editor_configs['height'] = '100px';
101
        $editor_configs['editor'] = $GLOBALS['xoopsModuleConfig']['text_editor'];
102
        $errorText                = new \XoopsFormEditor(\_AM_XHTTPERR_ERROR_TEXT, 'error_text', $editor_configs);
103
        $errorText->setDescription(\_AM_XHTTPERR_ERROR_TEXT_DESC);
104
        $formObj->addElement($errorText);
105
        // Text options
106
        $errorTextOptions = new \XoopsFormElementTray(\_AM_XHTTPERR_ERROR_TEXT_OPTIONS, '|', '');
107
        $errorTextOptions->addElement(new \XoopsFormRadioYN(\_AM_XHTTPERR_ERROR_TEXT_HTML, 'error_text_html', $this->getVar('error_text_html'), _YES, _NO));
0 ignored issues
show
It seems like $this->getVar('error_text_html') can also be of type array and array; however, parameter $value of XoopsFormRadioYN::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

107
        $errorTextOptions->addElement(new \XoopsFormRadioYN(\_AM_XHTTPERR_ERROR_TEXT_HTML, 'error_text_html', /** @scrutinizer ignore-type */ $this->getVar('error_text_html'), _YES, _NO));
Loading history...
108
        $errorTextOptions->addElement(new \XoopsFormRadioYN(\_AM_XHTTPERR_ERROR_TEXT_SMILEY, 'error_text_smiley', $this->getVar('error_text_smiley'), _YES, _NO));
109
        $errorTextOptions->addElement(new \XoopsFormRadioYN(\_AM_XHTTPERR_ERROR_TEXT_BREAKS, 'error_text_breaks', $this->getVar('error_text_breaks'), _YES, _NO));
110
        $errorTextOptions->setDescription(\_AM_XHTTPERR_ERROR_TEXT_OPTIONS_DESC);
111
        $formObj->addElement($errorTextOptions);
112
        unset($errorTextOptions);
113
        // Showme
114
        $errorShowme = new \XoopsFormRadioYN(\_AM_XHTTPERR_ERROR_STATUS, 'error_showme', $this->getVar('error_showme'), _YES, _NO);
115
        $errorShowme->setDescription(\_AM_XHTTPERR_ERROR_STATUS_DESC);
116
        $formObj->addElement($errorShowme);
117
        unset($errorShowme);
118
119
        $formObj->addElement(new \XoopsFormLabel(_AM_XHTTPERR_ERROR_REDIRECT_OPTIONS, '', ''));
120
        // Redirect
121
        $errorRedirect = new \XoopsFormSelect(\_AM_XHTTPERR_ERROR_REDIRECT, 'error_redirect', $this->getVar('error_redirect'), 1, false);
122
        $errorRedirect->addOption(\XHTTPERR_REDIRECT_NO, \_AM_XHTTPERR_ERROR_REDIRECT_OPTION_NO);
123
        $errorRedirect->addOption(\XHTTPERR_REDIRECT_URI, \_AM_XHTTPERR_ERROR_REDIRECT_OPTION_URI);
124
        $errorRedirect->addOption(\XHTTPERR_REDIRECT_PREVIOUS, \_AM_XHTTPERR_ERROR_REDIRECT_OPTION_PREVIOUS);
125
        //$errorRedirect = new \XoopsFormRadioYN(, _YES, _NO);
126
        $errorRedirect->setDescription(\_AM_XHTTPERR_ERROR_REDIRECT_DESC);
127
        $formObj->addElement($errorRedirect);
128
        unset($errorRedirect);
129
        // Redirect time
130
        $errorRedirectTime = new \XoopsFormText(\_AM_XHTTPERR_ERROR_REDIRECT_TIME, 'error_redirect_time', 2, 2, $this->getVar('error_redirect_time'));
131
        $errorRedirectTime->setDescription(\_AM_XHTTPERR_ERROR_REDIRECT_TIME_DESC);
132
        $formObj->addElement($errorRedirectTime);
133
        unset($errorRedirectTime);
134
        /* IN PROGRESS
135
        // Redirect message
136
            $errorRedirectMessage = new \XoopsFormText(_AM_XHTTPERR_ERROR_REDIRECT_MESSAGE, 'error_redirect_message', 40, 255, $this->getVar('error_redirect_message'));
137
            $errorRedirectMessage->setDescription(_AM_XHTTPERR_ERROR_REDIRECT_MESSAGE_DESC);
138
        $formObj->addElement($errorRedirectMessage, true);
139
        unset($errorRedirectMessage);
140
        */
141
        // Redirect uri
142
        $errorRedirectUri = new \XoopsFormText(\_AM_XHTTPERR_ERROR_REDIRECT_URI, 'error_redirect_uri', 40, 255, $this->getVar('error_redirect_uri'));
143
        $errorRedirectUri->setDescription(\_AM_XHTTPERR_ERROR_REDIRECT_URI_DESC);
144
        $formObj->addElement($errorRedirectUri);
145
        unset($errorRedirectUri);
146
147
        // Captcha
148
        \xoops_load('xoopscaptcha');
149
        $formObj->addElement(new \XoopsFormCaptcha(), true);
150
        // Hidden Fields
151
        $formObj->addElement(new \XoopsFormHidden('op', 'save_error'));
152
        if ($this->isNew()) {
153
            // NOP
154
        } else {
155
            $formObj->addElement(new \XoopsFormHidden('error_id', $this->getVar('error_id')));
0 ignored issues
show
It seems like $this->getVar('error_id') can also be of type array and array; however, parameter $value of XoopsFormHidden::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

155
            $formObj->addElement(new \XoopsFormHidden('error_id', /** @scrutinizer ignore-type */ $this->getVar('error_id')));
Loading history...
156
        }
157
        // Submit button
158
        $buttonTray = new \XoopsFormElementTray(\_AM_XHTTPERR_ACTION, '', '');
159
        $buttonTray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
160
        $buttonTray->addElement(new \XoopsFormButton('', 'reset', _RESET, 'reset'));
161
        $cancel_button = new \XoopsFormButton('', 'cancel', _CANCEL, 'button');
162
        $cancel_button->setExtra("onclick='javascript:history.back();'");
163
        $buttonTray->addElement($cancel_button);
164
        $formObj->addElement($buttonTray);
165
166
        return $formObj;
167
    }
168
}
169