Issues (496)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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/Rating.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php namespace XoopsModules\Smartobject;
2
3
/*
4
 * You may not change or alter any portion of this comment or credits
5
 * of supporting developers from this source code or any supporting source code
6
 * which is considered copyrighted (c) material of the original comment or credit authors.
7
 *
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
13
/**
14
 * @copyright    XOOPS Project https://xoops.org/
15
 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
16
 * @package
17
 * @since
18
 * @author     XOOPS Development Team
19
 */
20
21
use XoopsModules\Smartobject;
22
23
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
24
25
//require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php';
26
//require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartplugins.php';
27
28
/**
29
 * Class SmartobjectRating
30
 */
31
class Rating extends Smartobject\BaseSmartObject
32
{
33
    public $_modulePlugin = false;
34
35
    /**
36
     * SmartobjectRating constructor.
37
     */
38
    public function __construct()
39
    {
40
        $this->quickInitVar('ratingid', XOBJ_DTYPE_INT, true);
41
        $this->quickInitVar('dirname', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME);
42
        $this->quickInitVar('item', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_ITEM);
43
        $this->quickInitVar('itemid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_ITEMID);
44
        $this->quickInitVar('uid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_UID);
45
        $this->quickInitVar('date', XOBJ_DTYPE_LTIME, true, _CO_SOBJECT_RATING_DATE);
46
        $this->quickInitVar('rate', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_RATE);
47
48
        $this->initNonPersistableVar('name', XOBJ_DTYPE_TXTBOX, 'user', _CO_SOBJECT_RATING_NAME);
49
50
        $this->setControl('dirname', [
51
            'handler'  => 'rating',
52
            'method'   => 'getModuleList',
53
            'onSelect' => 'submit'
54
        ]);
55
56
        $this->setControl('item', [
57
            'object' => &$this,
58
            'method' => 'getItemList'
59
        ]);
60
61
        $this->setControl('uid', 'user');
62
63
        $this->setControl('rate', [
64
            'handler' => 'rating',
65
            'method'  => 'getRateList'
66
        ]);
67
    }
68
69
    /**
70
     * @param  string $key
71
     * @param  string $format
72
     * @return mixed
73
     */
74 View Code Duplication
    public function getVar($key, $format = 's')
75
    {
76
        if ('s' === $format && in_array($key, ['name', 'dirname'])) {
77
            //            return call_user_func(array($this, $key));
78
            return $this->{$key}();
79
        }
80
81
        return parent::getVar($key, $format);
82
    }
83
84
    /**
85
     * @return string
86
     */
87
    public function name()
88
    {
89
        $ret = Smartobject\Utility::getLinkedUnameFromId($this->getVar('uid', 'e'), true, []);
0 ignored issues
show
true is of type boolean, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
90
91
        return $ret;
92
    }
93
94
    /**
95
     * @return mixed
96
     */
97
    public function dirname()
98
    {
99
        global $smartobjectRatingHandler;
100
        $moduleArray = $smartobjectRatingHandler->getModuleList();
101
102
        return $moduleArray[$this->getVar('dirname', 'n')];
103
    }
104
105
    /**
106
     * @return mixed
107
     */
108
    public function getItemList()
109
    {
110
        $plugin = $this->getModulePlugin();
111
112
        return $plugin->getItemList();
113
    }
114
115
    /**
116
     * @return string
117
     */
118
    public function getItemValue()
119
    {
120
        $moduleUrl      = XOOPS_URL . '/modules/' . $this->getVar('dirname', 'n') . '/';
121
        $plugin         = $this->getModulePlugin();
122
        $pluginItemInfo = $plugin->getItemInfo($this->getVar('item'));
123
        if (!$pluginItemInfo) {
124
            return '';
125
        }
126
        $itemPath = sprintf($pluginItemInfo['url'], $this->getVar('itemid'));
127
        $ret      = '<a href="' . $moduleUrl . $itemPath . '">' . $pluginItemInfo['caption'] . '</a>';
128
129
        return $ret;
130
    }
131
132
    /**
133
     * @return mixed
134
     */
135
    public function getRateValue()
136
    {
137
        return $this->getVar('rate');
138
    }
139
140
    /**
141
     * @return bool
142
     */
143
    public function getModulePlugin()
144
    {
145
        if (!$this->_modulePlugin) {
146
            global $smartobjectRatingHandler;
147
            $this->_modulePlugin = $smartobjectRatingHandler->pluginsObject->getPlugin($this->getVar('dirname', 'n'));
148
        }
149
150
        return $this->_modulePlugin;
151
    }
152
}
153