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/Review.php (6 issues)

Labels
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
require_once \dirname(__DIR__) . '/include/common.php';
28
29
/**
30
 * Class Review
31
 */
32
class Review extends \XoopsObject
33
{
34
    /**
35
     * @access public
36
     */
37
    public $helper;
38
    public $db;
39
40
    /**
41
     * @param int|null $id
42
     */
43
    public function __construct($id = null)
44
    {
45
        /** @var \XoopsModules\Wfdownloads\Helper $this ->helper */
46
        $this->helper = Helper::getInstance();
0 ignored issues
show
The property helper does not seem to exist on XoopsModules\Wfdownloads\Helper.
Loading history...
47
        $this->db     = \XoopsDatabaseFactory::getDatabaseConnection();
0 ignored issues
show
The property db does not seem to exist on XoopsModules\Wfdownloads\Helper.
Loading history...
48
        $this->initVar('review_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

48
        $this->/** @scrutinizer ignore-call */ 
49
               initVar('review_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...
49
        $this->initVar('lid', \XOBJ_DTYPE_INT);
50
        $this->initVar('title', \XOBJ_DTYPE_TXTBOX);
51
        $this->initVar('review', \XOBJ_DTYPE_TXTAREA);
52
        $this->initVar('submit', \XOBJ_DTYPE_INT); // boolean
53
        $this->initVar('date', \XOBJ_DTYPE_INT);
54
        $this->initVar('uid', \XOBJ_DTYPE_INT);
55
        $this->initVar('rated', \XOBJ_DTYPE_INT);
56
57
        if (null !== $id) {
58
            $item = $this->helper->getHandler('Item')->get($id);
59
            foreach ($item->vars as $k => $v) {
60
                $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

60
                $this->/** @scrutinizer ignore-call */ 
61
                       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...
61
            }
62
        }
63
    }
64
65
    /**
66
     * @return \XoopsThemeForm
67
     */
68
    public function getForm()
69
    {
70
        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
71
        $uid = !empty($GLOBALS['xoopsUser']) ? (int)$GLOBALS['xoopsUser']->getVar('uid') : 0;
72
73
        $form = new \XoopsThemeForm(\_AM_WFDOWNLOADS_REV_SNEWMNAMEDESC, 'reviewform', $_SERVER['REQUEST_URI']);
74
        // review: title
75
        $form->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_REV_FTITLE, 'title', 30, 40, $this->getVar('title', 'e')), true);
0 ignored issues
show
It seems like $this->getVar('title', '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

75
        $form->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_REV_FTITLE, 'title', 30, 40, /** @scrutinizer ignore-type */ $this->getVar('title', 'e')), true);
Loading history...
76
        // review: rated
77
        $rating_select = new \XoopsFormSelect(\_AM_WFDOWNLOADS_REV_FRATING, 'rated', $this->getVar('rated'));
78
        $rating_select->addOptionArray(
79
            [
80
                '1'  => 1,
81
                '2'  => 2,
82
                '3'  => 3,
83
                '4'  => 4,
84
                '5'  => 5,
85
                '6'  => 6,
86
                '7'  => 7,
87
                '8'  => 8,
88
                '9'  => 9,
89
                '10' => 10,
90
            ]
91
        );
92
        $form->addElement($rating_select);
93
        // review: review
94
        $form->addElement(new \XoopsFormDhtmlTextArea(\_AM_WFDOWNLOADS_REV_FDESCRIPTION, 'review', $this->getVar('review', 'e'), 15, 60), true);
0 ignored issues
show
It seems like $this->getVar('review', 'e') can also be of type array and array; however, parameter $value of XoopsFormDhtmlTextArea::__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

94
        $form->addElement(new \XoopsFormDhtmlTextArea(\_AM_WFDOWNLOADS_REV_FDESCRIPTION, 'review', /** @scrutinizer ignore-type */ $this->getVar('review', 'e'), 15, 60), true);
Loading history...
95
        // form: approve
96
        $approved         = (0 == $this->getVar('submit')) ? 0 : 1;
97
        $approve_checkbox = new \XoopsFormCheckBox(\_AM_WFDOWNLOADS_REV_FAPPROVE, 'approve', $approved);
98
        $approve_checkbox->addOption(1, ' ');
99
        $form->addElement($approve_checkbox);
100
        // review: lid
101
        $form->addElement(new \XoopsFormHidden('lid', (int)$this->getVar('lid')));
102
        // review: uid
103
        $form->addElement(new \XoopsFormHidden('uid', $uid));
104
        // review: review_id
105
        $form->addElement(new \XoopsFormHidden('review_id', (int)$this->getVar('review_id')));
106
        // form: confirm
107
        $form->addElement(new \XoopsFormHidden('confirm', 1));
108
        // form: op
109
        $form->addElement(new \XoopsFormHidden('op', ''));
110
        // form: buttons
111
        $buttonTray = new \XoopsFormElementTray('', '');
112
        if ($this->isNew()) {
113
            $butt_create = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_BSAVE, 'submit');
114
            $butt_create->setExtra('onclick="this.form.elements.op.value=\'review.save\'"');
115
            $buttonTray->addElement($butt_create);
116
            $butt_clear = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_BRESET, 'reset');
117
            $buttonTray->addElement($butt_clear);
118
            $butt_cancel = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_BCANCEL, 'button');
119
            $butt_cancel->setExtra('onclick="history.go(-1)"');
120
            $buttonTray->addElement($butt_cancel);
121
        } else {
122
            $butt_create = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_BSAVE, 'submit');
123
            $butt_create->setExtra('onclick="this.form.elements.op.value=\'review.save\'"');
124
            $buttonTray->addElement($butt_create);
125
            $butt_delete = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_BDELETE, 'submit');
126
            $butt_delete->setExtra('onclick="this.form.elements.op.value=\'review.delete\'"');
127
            $buttonTray->addElement($butt_delete);
128
            $butt_cancel = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_BCANCEL, 'button');
129
            $butt_cancel->setExtra('onclick="history.go(-1)"');
130
            $buttonTray->addElement($butt_cancel);
131
        }
132
        $form->addElement($buttonTray);
133
134
        return $form;
135
    }
136
}
137