Issues (267)

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/Lists.php (4 issues)

1
<?php
2
3
namespace XoopsModules\Xoopstube;
4
5
/**
6
 * Module: XoopsTube
7
 *
8
 * You may not change or alter any portion of this comment or credits
9
 * of supporting developers from this source code or any supporting source code
10
 * which is considered copyrighted (c) material of the original comment or credit authors.
11
 *
12
 * PHP version 5
13
 *
14
 * @category        Module
15
 * @package         Xoopstube
16
 * @author          XOOPS Development Team
17
 * @copyright       2001-2016 XOOPS Project (https://xoops.org)
18
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
19
 * @link            https://xoops.org/
20
 * @since           1.0.6
21
 */
22
23
use XoopsModules\Xoopstube;
24
25
/**
26
 * Class Lists
27
 * @package XoopsModules\Xoopstube
28
 */
29
class Lists
30
{
31
    public $value;
32
    public $selected;
33
    public $path = 'uploads';
34
    public $size;
35
    public $emptyselect;
36
    public $type;
37
    public $prefix;
38
    public $suffix;
39
40
    /**
41
     * @param string $path
42
     * @param null   $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
43
     * @param string $selected
44
     * @param int    $size
45
     * @param int    $emptyselect
46
     * @param int    $type
47
     * @param string $prefix
48
     * @param string $suffix
49
     */
50
    public function __construct(
51
        $path = 'uploads',
52
        $value = null,
53
        $selected = '',
54
        $size = 1,
55
        $emptyselect = 0,
56
        $type = 0,
57
        $prefix = '',
0 ignored issues
show
The parameter $prefix is not used and could be removed. ( Ignorable by Annotation )

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

57
        /** @scrutinizer ignore-unused */ $prefix = '',

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
58
        $suffix = ''
0 ignored issues
show
The parameter $suffix is not used and could be removed. ( Ignorable by Annotation )

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

58
        /** @scrutinizer ignore-unused */ $suffix = ''

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
59
    ) {
60
        $this->value       = $value;
61
        $this->selected   = $selected;
62
        $this->path        = $path;
63
        $this->size        = (int)$size;
64
        $this->emptyselect = $emptyselect ? 0 : 1;
65
        $this->type        = $type;
66
    }
67
68
    /**
69
     * @param array $this_array
70
     *
71
     * @return string
72
     */
73
    public function getarray($this_array)
74
    {
75
        $ret = "<select size='" . $this->size() . "' name='$this->value()'>";
76
        if ($this->emptyselect) {
77
            $ret .= "<option value='" . $this->value() . "'>----------------------</option>";
0 ignored issues
show
Are you sure the usage of $this->value() targeting XoopsModules\Xoopstube\Lists::value() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
78
        }
79
        foreach ($this_array as $content) {
80
            $opt_selected = '';
81
82
            if ($content[0] == $this->isSelected()) {
83
                $opt_selected = "selected='selected'";
84
            }
85
            $ret .= "<option value='" . $content . "' $opt_selected>" . $content . '</option>';
86
        }
87
        $ret .= '</select>';
88
89
        return $ret;
90
    }
91
92
    /**
93
     * Private to be called by other parts of the class
94
     *
95
     * @param $dirname
96
     *
97
     * @return array
98
     */
99
    public function getDirListAsArray($dirname)
100
    {
101
        $dirlist = [];
102
        if (\is_dir($dirname) && $handle = \opendir($dirname)) {
103
            while (false !== ($file = \readdir($handle))) {
104
                if (!\preg_match('/^[.]{1,2}$/', $file)) {
105
                    if ('cvs' !== mb_strtolower($file) && \is_dir($dirname . $file)) {
106
                        $dirlist[$file] = $file;
107
                    }
108
                }
109
            }
110
            \closedir($handle);
111
112
            \reset($dirlist);
113
        }
114
115
        return $dirlist;
116
    }
117
118
    /**
119
     * @param        $dirname
120
     * @param string $type
121
     * @param string $prefix
122
     * @param int    $noselection
123
     *
124
     * @return array
125
     */
126
    public static function getListTypeAsArray($dirname, $type = '', $prefix = '', $noselection = 1)
127
    {
128
        $filelist = [];
129
        switch (\trim($type)) {
130
            case 'images':
131
                $types = '[.gif|.jpg|.png]';
132
                if ($noselection) {
133
                    $filelist[''] = \_AM_XOOPSTUBE_NOIMAGE;
134
                }
135
                break;
136
            case 'media':
137
                $types = '[.aac|.flv|.mp3|.mp4|.swf]';
138
                if ($noselection) {
139
                    $filelist[''] = \_AM_XOOPSTUBE_NOVIDEO;
140
                }
141
                break;
142
            case 'html':
143
                $types = '[.htm|.tpl|.html|.xhtml|.php|.php3|.phtml|.txt]';
144
                if ($noselection) {
145
                    $filelist[''] = \_AM_XOOPSTUBE_NOSELECT;
146
                }
147
                break;
148
            default:
149
                $types = '';
150
                if ($noselection) {
151
                    $filelist[''] = \_AM_XOOPSTUBE_NOFILESELECT;
152
                }
153
                break;
154
        }
155
156
        if ('/' === mb_substr($dirname, -1)) {
157
            $dirname = mb_substr($dirname, 0, -1);
158
        }
159
160
        if (\is_dir($dirname) && $handle = \opendir($dirname)) {
161
            while (false !== ($file = \readdir($handle))) {
162
                if (!\preg_match('/^[.]{1,2}$/', $file) && \preg_match("/$types$/i", $file) && \is_file($dirname . '/' . $file)) {
163
                    if ('blank.gif' === mb_strtolower($file)) {
164
                        continue;
165
                    }
166
                    $file            = $prefix . $file;
167
                    $filelist[$file] = $file;
168
                }
169
            }
170
            \closedir($handle);
171
            \asort($filelist);
172
            \reset($filelist);
173
        }
174
175
        return $filelist;
176
    }
177
178
    /**
179
     * @return null
180
     */
181
    public function value()
182
    {
183
        return $this->value;
184
    }
185
186
    public function isSelected()
187
    {
188
        return $this->selected;
189
    }
190
191
    /**
192
     * @return string
193
     */
194
    public function paths()
195
    {
196
        return $this->path;
197
    }
198
199
    /**
200
     * @return int
201
     */
202
    public function size()
203
    {
204
        return $this->size;
205
    }
206
207
    /**
208
     * @return int
209
     */
210
    public function isEmptySelect()
211
    {
212
        return $this->emptyselect;
213
    }
214
215
    /**
216
     * @return int
217
     */
218
    public function getType()
219
    {
220
        return $this->type;
221
    }
222
223
    public function getPrefix()
224
    {
225
        return $this->prefix;
226
    }
227
228
    public function getSuffix()
229
    {
230
        return $this->suffix;
231
    }
232
}
233