Issues (149)

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

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
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
 * Module: Equipment
15
 *
16
 * @category        Module
17
 * @package         equipment
18
 * @author          XOOPS Development Team <[email protected]> - <http://xoops.org>
19
 * @copyright       {@link https://xoops.org/ XOOPS Project}
20
 * @license         GPL 2.0 or later
21
 * @link            https://xoops.org/
22
 * @since           1.0.0
23
 */
24
25
use Xmf\Module\Helper\Permission;
26
27
$moduleDirName = basename(dirname(__DIR__));
28
29
$permHelper = new Permission($moduleDirName);
30
31
/**
32
 * Class EquipmentRentals
33
 */
34 View Code Duplication
class EquipmentRentals extends XoopsObject
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
{
36
    /**
37
     * Constructor
38
     *
39
     * @param null
40
     */
41
    public function __construct()
42
    {
43
        parent::__construct();
44
        $this->initVar('id', XOBJ_DTYPE_INT);
45
        $this->initVar('customerid', XOBJ_DTYPE_INT);
46
        $this->initVar('equipmentid', XOBJ_DTYPE_INT);
47
        $this->initVar('quantity', XOBJ_DTYPE_INT);
48
        $this->initVar('datefrom', XOBJ_DTYPE_TIMESTAMP);
49
        $this->initVar('dateto', XOBJ_DTYPE_TIMESTAMP);
50
    }
51
52
    /**
53
     * Get form
54
     *
55
     * @param null
56
     * @return EquipmentRentalsForm
57
     */
58
    public function getForm()
59
    {
60
        require_once XOOPS_ROOT_PATH . '/modules/equipment/class/form/rentals.php';
61
62
        $form = new EquipmentRentalsForm($this);
63
        return $form;
64
    }
65
66
    /**
67
     * @return array|null
68
     */
69
    public function getGroupsRead()
70
    {
71
        global $permHelper;
72
        //return $this->publisher->getHandler('permission')->getGrantedGroupsById('rentals_read', id);
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
73
        return $permHelper->getGroupsForItem('sbcolumns_read', $this->getVar('id'));
74
    }
75
76
    /**
77
     * @return array|null
78
     */
79
    public function getGroupsSubmit()
80
    {
81
        global $permHelper;
82
        //        return $this->publisher->getHandler('permission')->getGrantedGroupsById('rentals_submit', id);
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
83
        return $permHelper->getGroupsForItem('sbcolumns_submit', $this->getVar('id'));
84
    }
85
86
    /**
87
     * @return array|null
88
     */
89
    public function getGroupsModeration()
90
    {
91
        global $permHelper;
92
        //        return $this->publisher->getHandler('permission')->getGrantedGroupsById('rentals_moderation', id);
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
93
        return $permHelper->getGroupsForItem('sbcolumns_moderation', $this->getVar('id'));
94
    }
95
}
96
97
/**
98
 * Class EquipmentRentalsHandler
99
 */
100
class EquipmentRentalsHandler extends XoopsPersistableObjectHandler
101
{
102
    /**
103
     * Constructor
104
     * @param null|XoopsDatabase $db
105
     */
106
107
    public function __construct(XoopsDatabase $db)
108
    {
109
        parent::__construct($db, 'equipment_rentals', 'EquipmentRentals', 'id', 'customerid');
110
    }
111
112
    /**
113
     * @return string
114
     */
115
    public function getDataJson()
116
    {
117
        global $xoopsDB, $xoopsUser;
118
119
//        $borrow_sql = sprintf('SELECT `%1$s`.`amount`, `name`, `owner`
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
120
//                    FROM `%1$s`
121
//                    INNER JOIN `%2$s` ON `%1$s`.`id`=`%2$s`.`id` WHERE `%1$s`.`borrower`="%3$s"', $xoopsDB->prefix('equipment_rentals'), $xoopsDB->prefix('equipment_equipment'), $xoopsUser->uname());
122
123
        $borrow_sql = 'SELECT r.quantity, e.name, c.first, c.last FROM ' . $xoopsDB->prefix('equipment_equipment') . ' AS e, ' . $xoopsDB->prefix('equipment_customer') . ' AS c, '
124
                      . $xoopsDB->prefix('equipment_rentals') . ' AS r WHERE e.id = r.equipmentid AND c.id = r.customerid';
125
126
        $borrow_data = EquipmentUtility::getQueryDataToJSON($borrow_sql);
127
128
        return $borrow_data;
129
    }
130
}
131