Issues (411)

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/Mimetype.php (10 issues)

1
<?php
2
3
namespace XoopsModules\Wfdownloads;
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
 * Wfdownloads module
17
 *
18
 * @copyright       XOOPS Project (https://xoops.org)
19
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
20
 * @package         wfdownload
21
 * @since           3.23
22
 * @author          Xoops Development Team
23
 */
24
25
use XoopsModules\Wfdownloads;
26
27
/*
28
CREATE TABLE wfdownloads_mimetypes (
29
  mime_id int(11) NOT NULL auto_increment,
30
  mime_ext varchar(60) NOT NULL default '',
31
  mime_types text NOT NULL,
32
  mime_name varchar(255) NOT NULL default '',
33
  mime_admin int(1) NOT NULL default '1',
34
  mime_user int(1) NOT NULL default '0',
35
  KEY mime_id (mime_id)
36
) ENGINE=MyISAM;
37
*/
38
39
require_once \dirname(__DIR__) . '/include/common.php';
40
41
/**
42
 * Class Mimetype
43
 */
44
class Mimetype extends \XoopsObject
45
{
46
    /**
47
     * @access public
48
     */
49
    public $helper;
50
    public $db;
51
52
    /**
53
     * @param int|null $id
54
     */
55
    public function __construct($id = null)
56
    {
57
        /** @var \XoopsModules\Wfdownloads\Helper $this ->helper */
58
        $this->helper = Helper::getInstance();
0 ignored issues
show
The property helper does not seem to exist on XoopsModules\Wfdownloads\Helper.
Loading history...
59
        $this->db     = \XoopsDatabaseFactory::getDatabaseConnection();
0 ignored issues
show
The property db does not seem to exist on XoopsModules\Wfdownloads\Helper.
Loading history...
60
        $this->initVar('mime_id', \XOBJ_DTYPE_INT);
0 ignored issues
show
The method initVar() does not exist on XoopsModules\Wfdownloads\Helper. Did you maybe mean init()? ( Ignorable by Annotation )

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

60
        $this->/** @scrutinizer ignore-call */ 
61
               initVar('mime_id', \XOBJ_DTYPE_INT);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
61
        $this->initVar('mime_ext', \XOBJ_DTYPE_TXTBOX, '');
62
        $this->initVar('mime_types', \XOBJ_DTYPE_TXTAREA, '');
63
        $this->initVar('mime_name', \XOBJ_DTYPE_TXTBOX, '');
64
        $this->initVar('mime_admin', \XOBJ_DTYPE_INT, true); // boolean
65
        $this->initVar('mime_user', \XOBJ_DTYPE_INT, false); // boolean
66
67
        if (null !== $id) {
68
            $item = $this->helper->getHandler('Item')->get($id);
69
            foreach ($item->vars as $k => $v) {
70
                $this->assignVar($k, $v['value']);
0 ignored issues
show
The method assignVar() does not exist on XoopsModules\Wfdownloads\Helper. ( Ignorable by Annotation )

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

70
                $this->/** @scrutinizer ignore-call */ 
71
                       assignVar($k, $v['value']);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
71
            }
72
        }
73
    }
74
75
    /**
76
     * @param bool $action
77
     *
78
     * @return \XoopsThemeForm
79
     */
80
    public function getForm($action = false)
81
    {
82
        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
83
84
        if (!$action) {
85
            $action = $_SERVER['REQUEST_URI'];
86
        }
87
        $title = $this->isNew() ? \_AM_WFDOWNLOADS_MIME_CREATEF : \_AM_WFDOWNLOADS_MIME_MODIFYF;
88
89
        $form = new \XoopsThemeForm($title, 'form_error', $action, 'post', true);
90
        $form->setExtra('enctype="multipart/form-data"');
91
        // mime_ext
92
        $mime_ext_text = new \XoopsFormText(\_AM_WFDOWNLOADS_MIME_EXTF, 'mime_ext', 5, 60, $this->getVar('mime_ext', 'e'));
0 ignored issues
show
It seems like $this->getVar('mime_ext', 'e') 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

92
        $mime_ext_text = new \XoopsFormText(\_AM_WFDOWNLOADS_MIME_EXTF, 'mime_ext', 5, 60, /** @scrutinizer ignore-type */ $this->getVar('mime_ext', 'e'));
Loading history...
93
        $mime_ext_text->setDescription(\_AM_WFDOWNLOADS_MIME_EXTF_DESC);
94
        $form->addElement($mime_ext_text, true);
95
        // mime_name
96
        $mime_name_text = new \XoopsFormText(\_AM_WFDOWNLOADS_MIME_NAMEF, 'mime_name', 50, 255, $this->getVar('mime_name', 'e'));
97
        $mime_name_text->setDescription(\_AM_WFDOWNLOADS_MIME_NAMEF_DESC);
98
        $form->addElement($mime_name_text, true);
99
        // mime_type
100
        $mime_type_textarea = new \XoopsFormTextArea(\_AM_WFDOWNLOADS_MIME_TYPEF, 'mime_type', $this->getVar('mime_types', 'e'));
0 ignored issues
show
It seems like $this->getVar('mime_types', 'e') can also be of type array and array; however, parameter $value of XoopsFormTextArea::__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

100
        $mime_type_textarea = new \XoopsFormTextArea(\_AM_WFDOWNLOADS_MIME_TYPEF, 'mime_type', /** @scrutinizer ignore-type */ $this->getVar('mime_types', 'e'));
Loading history...
101
        $mime_type_textarea->setDescription(\_AM_WFDOWNLOADS_MIME_TYPEF_DESC);
102
        $form->addElement($mime_type_textarea, 7, 60);
0 ignored issues
show
7 of type integer is incompatible with the type boolean expected by parameter $required of XoopsForm::addElement(). ( Ignorable by Annotation )

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

102
        $form->addElement($mime_type_textarea, /** @scrutinizer ignore-type */ 7, 60);
Loading history...
The call to XoopsForm::addElement() has too many arguments starting with 60. ( Ignorable by Annotation )

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

102
        $form->/** @scrutinizer ignore-call */ 
103
               addElement($mime_type_textarea, 7, 60);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
103
        // mime_admin
104
        $madmin_radio = new \XoopsFormRadioYN(\_AM_WFDOWNLOADS_MIME_ADMINF, 'mime_admin', $this->getVar('mime_admin', 'e'));
0 ignored issues
show
It seems like $this->getVar('mime_admin', 'e') 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

104
        $madmin_radio = new \XoopsFormRadioYN(\_AM_WFDOWNLOADS_MIME_ADMINF, 'mime_admin', /** @scrutinizer ignore-type */ $this->getVar('mime_admin', 'e'));
Loading history...
105
        $form->addElement($madmin_radio);
106
        // mime_user
107
        $muser_radio = new \XoopsFormRadioYN(\_AM_WFDOWNLOADS_MIME_USERF, 'mime_user', $this->getVar('mime_user', 'e'));
108
        $form->addElement($muser_radio);
109
        // op
110
        $form->addElement(new \XoopsFormHidden('op', 'save'));
111
        // buttons
112
        $buttonTray = new \XoopsFormElementTray('', '');
113
        if ($this->isNew()) {
114
            $butt_create = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CREATE, 'submit');
115
            $butt_create->setExtra('onclick="this.form.elements.op.value=\'mimetype.save\'"');
116
            $buttonTray->addElement($butt_create);
117
            $butt_clear = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CLEAR, 'reset');
118
            $buttonTray->addElement($butt_clear);
119
            $butt_cancel = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CANCEL, 'button');
120
            $butt_cancel->setExtra('onclick="history.go(-1)"');
121
            $buttonTray->addElement($butt_cancel);
122
        } else {
123
            $form->addElement(new \XoopsFormHidden('mime_id', $this->getVar('mime_id')));
0 ignored issues
show
It seems like $this->getVar('mime_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

123
            $form->addElement(new \XoopsFormHidden('mime_id', /** @scrutinizer ignore-type */ $this->getVar('mime_id')));
Loading history...
124
            $butt_create = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_MODIFY, 'submit');
125
            $butt_create->setExtra('onclick="this.form.elements.op.value=\'mimetype.save\'"');
126
            $buttonTray->addElement($butt_create);
127
            $butt_cancel = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CANCEL, 'button');
128
            $butt_cancel->setExtra('onclick="history.go(-1)"');
129
            $buttonTray->addElement($butt_cancel);
130
        }
131
        $form->addElement($buttonTray);
132
133
        return $form;
134
    }
135
}
136