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

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
/**
28
 * Class WfsLists
29
 * @package XoopsModules\Wfdownloads
30
 */
31
class WfsLists
32
{
33
    public $value;
34
    public $selected;
35
    public $path = 'uploads';
36
    public $size;
37
    public $emptyselect;
38
    public $type;
39
    public $prefix;
40
    public $suffix;
41
42
    /**
43
     * $value:
44
     * Selection:
45
     * Path:
46
     * Size:
47
     * emptyselect:
48
     * $type: Filter which types of files should be returned
49
     *        Html
50
     *        Images
51
     *        files
52
     *        dir
53
     *
54
     * @param string $path
55
     * @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...
56
     * @param string $selected
57
     * @param int    $size
58
     * @param int    $emptyselect
59
     * @param int    $type
60
     * @param string $prefix
61
     * @param string $suffix
62
     */
63
    public function __construct(
64
        $path = 'uploads',
65
        $value = null,
66
        $selected = '',
67
        $size = 1,
68
        $emptyselect = 0,
69
        $type = 0,
70
        $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

70
        /** @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...
71
        $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

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