Issues (807)

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

1
<?php
2
3
namespace XoopsModules\Pedigree;
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
 * @package         XoopsModules\Pedigree
17
 * @copyright       {@link https://xoops.org/ XOOPS Project}
18
 * @license         {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
19
 * @author          XOOPS Module Dev Team
20
 */
21
22
use XoopsModules\Pedigree;
23
24
/**
25
 * Class Pedigree\SelectBox
26
 */
27
class SelectBox extends Pedigree\HtmlInputAbstract
28
{
29
    // Define class variables
30
    private $fieldnumber;
31
    private $fieldname;
32
    private $value;
33
    private $defaultvalue;
34
    private $lookuptable;
35
    private $size = 1;
36
37
    /**
38
     * Constructor
39
     * @param \XoopsModules\Pedigree\Field  $parentObject
40
     * @param \XoopsModules\Pedigree\Animal $animalObject
41
     */
42
    public function __construct(Pedigree\Field $parentObject, Pedigree\Animal $animalObject)
43
    {
44
        $this->fieldnumber  = $parentObject->getId();
45
        $this->fieldname    = $parentObject->fieldname;
0 ignored issues
show
The property fieldname does not seem to exist on XoopsModules\Pedigree\Field.
Loading history...
46
        $this->value        = $animalObject->{'user' . $this->fieldnumber};
47
        $this->defaultvalue = $parentObject->defaultvalue;
0 ignored issues
show
The property defaultvalue does not seem to exist on XoopsModules\Pedigree\Field.
Loading history...
48
        $this->lookuptable  = $parentObject->lookuptable;
0 ignored issues
show
The property lookuptable does not seem to exist on XoopsModules\Pedigree\Field.
Loading history...
49
        if (0 == $this->lookuptable) {
50
            echo "<span style='color: #ff0000;'><h3>A lookuptable must be specified for userfield" . $this->fieldnumber . '</h3></span>';
51
        }
52
    }
53
54
    /**
55
     * @return \XoopsFormSelect
56
     */
57
    public function editField()
58
    {
59
        $select         = new \XoopsFormSelect('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $value = $this->value, $this->size, $multiple = false);
60
        $lookupcontents = parent::lookupField($this->fieldnumber);
61
        $lcCount        = \count($lookupcontents);
0 ignored issues
show
The assignment to $lcCount is dead and can be removed.
Loading history...
62
        foreach ($lookupcontents as $i => $iValue) {
63
            $select->addOption($lookupcontents[$i]['id'], $lookupcontents[$i]['value']);
64
        }
65
66
        return $select;
67
    }
68
69
    /**
70
     * @param string $name
71
     *
72
     * @return \XoopsFormSelect
73
     */
74
    public function newField($name = '')
75
    {
76
        $select         = new \XoopsFormSelect('<b>' . $this->fieldname . '</b>', $name . 'user' . $this->fieldnumber, $value = $this->defaultvalue, $this->size, $multiple = false);
77
        $lookupcontents = parent::lookupField($this->fieldnumber);
78
        $lcCount        = \count($lookupcontents);
0 ignored issues
show
The assignment to $lcCount is dead and can be removed.
Loading history...
79
        foreach ($lookupcontents as $i => $iValue) {
80
            $select->addOption($lookupcontents[$i]['id'], $lookupcontents[$i]['value']);
81
        }
82
83
        return $select;
84
    }
85
86
    /**
87
     * @return \XoopsFormLabel
88
     */
89
    public function viewField()
90
    {
91
        $lookupcontents = parent::lookupField($this->fieldnumber);
92
        $lcCount        = \count($lookupcontents);
0 ignored issues
show
The assignment to $lcCount is dead and can be removed.
Loading history...
93
        foreach ($lookupcontents as $i => $iValue) {
94
            if ($lookupcontents[$i]['id'] == $this->value) {
95
                $choosenvalue = $lookupcontents[$i]['value'];
96
            }
97
        }
98
        $view = new \XoopsFormLabel($this->fieldname, $choosenvalue);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $choosenvalue does not seem to be defined for all execution paths leading up to this point.
Loading history...
99
100
        return $view;
101
    }
102
103
    /**
104
     * @return string
105
     */
106
    public function showField()
107
    {
108
        $choosenvalue   = '';
109
        $lookupcontents = parent::lookupField($this->fieldnumber);
110
        $lcCount        = \count($lookupcontents);
0 ignored issues
show
The assignment to $lcCount is dead and can be removed.
Loading history...
111
        foreach ($lookupcontents as $i => $iValue) {
112
            if ($lookupcontents[$i]['id'] == $this->value) {
113
                $choosenvalue = $lookupcontents[$i]['value'];
114
            }
115
        }
116
117
        return $this->fieldname . ' : ' . $choosenvalue;
118
    }
119
120
    /**
121
     * @return string
122
     */
123
    public function showValue()
124
    {
125
        $choosenvalue   = '';
126
        $lookupcontents = parent::lookupField($this->fieldnumber);
127
        $lcCount        = \count($lookupcontents);
0 ignored issues
show
The assignment to $lcCount is dead and can be removed.
Loading history...
128
        foreach ($lookupcontents as $i => $iValue) {
129
            if ($lookupcontents[$i]['id'] == $this->value) {
130
                $choosenvalue = $lookupcontents[$i]['value'];
131
            }
132
        }
133
134
        return $choosenvalue;
135
    }
136
137
    /**
138
     * @return string HTML <select> for this field
139
     */
140
    public function searchField()
141
    {
142
        $select         = "<select size='1' name='query' style='width: 140px;'>";
143
        $lookupcontents = parent::lookupField($this->fieldnumber);
144
        $lcCount        = \count($lookupcontents);
0 ignored issues
show
The assignment to $lcCount is dead and can be removed.
Loading history...
145
        foreach ($lookupcontents as $i => $iValue) {
146
            $select .= "<option value='" . $lookupcontents[$i]['id'] . "'>" . $lookupcontents[$i]['value'] . '</option>';
147
        }
148
        $select .= '</select>';
149
150
        return $select;
151
    }
152
}
153